Inheritance diagram for wx.Pen:
A pen is a drawing tool for drawing outlines. It is used for drawing lines and painting the outline of rectangles, ellipses, etc. It has a colour, a width and a style.
See also
wxPython has a number of predefined pens (built-in), which are:
On a monochrome display, wxWidgets shows all non-white pens as black.
An application may wish to dynamically create pens with different string characteristics, and there is the consequent danger that a large number of duplicate pens will be created. Therefore an application may wish to get a pointer to a pen by using the global list of pens wx.ThePenList, and calling the member function FindOrCreatePen. See the entry for wx.PenList.
This class uses reference counting and copy-on-write internally so that assignments between two instances of this class are very cheap. You can therefore use actual objects instead of pointers without efficiency problems. If an instance of this class is changed it will create its own data internally so that other instances, which previously shared the data using the reference counting, are not affected.
Constructs a pen from a colour object, pen width and style.
Parameters:
colour (wx.Colour): A colour object.
width (int): Pen width. Under Windows, the pen width cannot be greater than 1 if the style is wx.DOT, wx.LONG_DASH, wx.SHORT_DASH, wx.DOT_DASH, or wx.USER_DASH.
style (int): The style may be one of the following:
Pen Styles |
Description |
---|---|
wx.SOLID |
Solid style. |
wx.TRANSPARENT |
No pen is used. |
wx.DOT |
Dotted style. |
wx.LONG_DASH |
Long dashed style. |
wx.SHORT_DASH |
Short dashed style. |
wx.DOT_DASH |
Dot and dash style. |
wx.STIPPLE |
Use the stipple bitmap. |
wx.USER_DASH |
Use the user dashes: see SetDashes |
wx.BDIAGONAL_HATCH |
Backward diagonal hatch. |
wx.CROSSDIAG_HATCH |
Cross-diagonal hatch. |
wx.FDIAGONAL_HATCH |
Forward diagonal hatch. |
wx.CROSS_HATCH |
Cross hatch. |
wx.HORIZONTAL_HATCH |
Horizontal hatch. |
wx.VERTICAL_HATCH |
Vertical hatch. |
Returns:
Returns the pen cap style, which may be one of wx.CAP_ROUND, wx.CAP_PROJECTING and wx.CAP_BUTT.
The default is wx.CAP_ROUND.
Returns:
int
See also
See also
Gets an array of dashes (defined as char in X, DWORD under Windows).
The function returns the number of dashes associated with this pen.
Returns:
list of integers
See also
Returns the pen join style, which may be one of wx.JOIN_BEVEL, wx.JOIN_ROUND and wx.JOIN_MITER.
The default is wx.JOIN_ROUND.
Returns:
int
See also
See also
Returns the pen style.
Returns:
int
See also
Returns the pen width.
Returns:
int
See also
Returns True if the pen is initialised.
Returns:
bool
Sets the pen cap style, which can be one of wx.CAP_ROUND, wx.CAP_PROJECTING and wx.CAP_BUTT.
Parameters:
See also
See also
Associates an array of pointers to dashes (defined as char in X, DWORD under Windows) with the pen.
The array is not deallocated by wx.Pen, but neither must it be deallocated by the calling application until the pen is deleted or this function is called with a None array.
Parameters:
See also
Sets the pen join style, which may be one of wx.JOIN_BEVEL, wx.JOIN_ROUND and wx.JOIN_MITER.
Parameters:
See also
See also
Set the pen style.
Parameters:
Sets the pen width.
Parameters:
See also