A brush is a drawing tool for filling in areas.
It is used for painting the background of rectangles, ellipses, etc. It has a colour and a style.
On a monochrome display, wxWidgets shows all brushes as white unless the colour is really black.
Do not initialize objects on the stack before the program commences, since other required structures may not have been set up yet. Instead, define global pointers to objects and create them in wx.App.OnInit
or when required.
An application may wish to create brushes with different characteristics dynamically, and there is the consequent danger that a large number of duplicate brushes will be created. Therefore an application may wish to get a pointer to a brush by using the global list of brushes wx.TheBrushList , and calling the member function wx.BrushList.FindOrCreateBrush
.
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.
See also
wx.BrushList, wx.DC, wx.DC.SetBrush
Default constructor. |
|
Returns a reference to the brush colour. |
|
Gets a pointer to the stipple bitmap. |
|
Returns the brush style, one of the wx.BrushStyle values. |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Sets the brush colour using red, green and blue values. |
|
Sets the stipple bitmap. |
|
Sets the brush style. |
|
For internal use only. |
|
Inequality operator. |
|
Equality operator. |
See |
|
wx.
Brush
(GDIObject)¶Possible constructors:
Brush()
Brush(colour, style=BRUSHSTYLE_SOLID)
Brush(stippleBitmap)
Brush(brush)
A brush is a drawing tool for filling in areas.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor.
The brush will be uninitialised, and wx.Brush: IsOk
will return False
.
__init__ (self, colour, style=BRUSHSTYLE_SOLID)
Constructs a brush from a colour object and style.
colour (wx.Colour) – Colour object.
style (BrushStyle) – One of the wx.BrushStyle enumeration values.
__init__ (self, stippleBitmap)
Constructs a stippled brush using a bitmap.
The brush style will be set to BRUSHSTYLE_STIPPLE
.
stippleBitmap (wx.Bitmap) –
__init__ (self, brush)
Copy constructor, uses reference counting.
brush (wx.Brush) –
GetStipple
(self)¶Gets a pointer to the stipple bitmap.
If the brush does not have a BRUSHSTYLE_STIPPLE
style, this bitmap may be not None
but uninitialised (i.e. wx.Bitmap: IsOk
returns False
).
See also
GetStyle
(self)¶Returns the brush style, one of the wx.BrushStyle values.
See also
IsHatch
(self)¶Returns True
if the style of the brush is any of hatched fills.
bool
See also
IsNonTransparent
(self)¶Returns True
if the brush is a valid non-transparent brush.
This method returns True
if the brush object is initialized and has a non-transparent style. Notice that this should be used instead of simply testing whether GetStyle
returns a style different from wx.BRUSHSTYLE_TRANSPARENT
if the brush may be invalid as GetStyle
would assert in this case.
bool
New in version 2.9.2..
See also
IsOk
(self)¶Returns True
if the brush is initialised.
Notice that an uninitialized brush object can’t be queried for any brush properties and all calls to the accessor methods on it will result in an assert failure.
bool
IsTransparent
(self)¶Returns True
if the brush is transparent.
A transparent brush is simply a brush with wx.BRUSHSTYLE_TRANSPARENT
style.
Notice that this function works even for non-initialized brushes (for which it returns False
) unlike tests of the form GetStyle
== wx.BRUSHSTYLE_TRANSPARENT
which would assert if the brush is invalid.
bool
New in version 2.9.2..
See also
MacSetTheme
(self, macThemeBrushID)¶SetColour
(self, *args, **kw)¶Sets the brush colour using red, green and blue values.
SetStipple
(self, bitmap)¶Sets the stipple bitmap.
bitmap (wx.Bitmap) – The bitmap to use for stippling.
Note
The style will be set to BRUSHSTYLE_STIPPLE
, unless the bitmap has a mask associated to it, in which case the style will be set to BRUSHSTYLE_STIPPLE_MASK_OPAQUE
.
See also
SetStyle
(self, style)¶Sets the brush style.
style (BrushStyle) – One of the wx.BrushStyle values.
See also
__bool__
(self)¶int
__nonzero__
(self)¶int
_copyFrom
(self, other)¶For internal use only.
__ne__
(self)¶Inequality operator.
See Object Comparison for more info.
brush (wx.Brush) –
__eq__
(self)¶Equality operator.
See Object Comparison for more info.
brush (wx.Brush) –
Stipple
¶See GetStipple
and SetStipple