******** wx.Brush ******** Inheritance diagram for `wx.Brush`: | .. inheritance-diagram:: wx.Brush | Description =========== 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. .. seealso:: `wx.BrushList `_, `wx.DC `_, `wx.DC.SetBrush `_ Derived From ^^^^^^^^^^^^^ * `wx.GDIObject `_ * `wx.Object `_ Remarks ^^^^^^^ On a monochrome display, wxWidgets shows all brushes as white unless the colour is really black. An application may wish to create brushes with different string 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 `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. Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `GetColour <#GetColour>`_ * `GetStipple <#GetStipple>`_ * `GetStyle <#GetStyle>`_ * `IsHatch <#IsHatch>`_ * `IsOk <#IsOk>`_ * `SetColour <#SetColour>`_ * `SetStipple <#SetStipple>`_ * `SetStyle <#SetStyle>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `Colour <#Colour>`_ * `Stipple <#Stipple>`_ * `Style <#Style>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(colour, style=wx.SOLID) Constructs a brush from a `wx.Colour `_ object and a style. **Parameters:** * `colour` (`wx.Colour `_) * `style` (int) | **Returns:** `wx.Brush `_ -------- .. method:: GetColour() Returns a reference to the brush colour. | **Returns:** `wx.Colour `_ .. seealso:: `SetColour <#SetColour>`_ -------- .. method:: GetStipple() Gets a pointer to the stipple bitmap. If the brush does not have a ``wx.STIPPLE`` style, this bitmap may be not ``None`` but uninitialised (`wx.Bitmap:IsOk `_ returns ``False``). | **Returns:** `wx.Bitmap `_ .. seealso:: `SetStipple <#SetStipple>`_ -------- .. method:: GetStyle() Returns the brush style, one of: ========================== ================================ ``wx.TRANSPARENT`` Transparent (no fill). ``wx.SOLID`` Solid. ``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. ``wx.STIPPLE`` Stippled using a bitmap. ``wx.STIPPLE_MASK_OPAQUE`` Stippled using a bitmap's mask. ========================== ================================ | **Returns:** `int` .. seealso:: `SetStyle <#SetStyle>`_, `SetColour <#SetColour>`_, `SetStipple <#SetStipple>`_ -------- .. method:: IsHatch() Returns ``True`` if the style of the brush is any of hatched fills. | **Returns:** `bool` .. seealso:: `GetStyle <#GetStyle>`_ -------- .. method:: IsOk() Returns ``True`` if the brush is initialised. It will return ``False`` if the default constructor has been used (for example, the brush is a member of a class, or ``None`` has been assigned to it). | **Returns:** `bool` -------- .. method:: SetColour(colour) Sets the brush colour using red, green and blue values. **Parameters:** * `colour` (`wx.Colour `_) .. seealso:: `GetColour <#GetColour>`_ -------- .. method:: SetStipple(stipple) Sets the stipple bitmap. **Parameters:** * `stipple` (`wx.Bitmap `_) .. note:: The style will be set to ``wx.STIPPLE``, unless the bitmap has a mask associated to it, in which case the style will be set to ``wx.STIPPLE_MASK_OPAQUE``. If the ``wx.STIPPLE`` variant is used, the bitmap will be used to fill out the area to be drawn. If the ``wx.STIPPLE_MASK_OPAQUE`` is used, the current text foreground and text background determine what colours are used for displaying and the bits in the mask (which is a mono-bitmap actually) determine where to draw what. .. note:: Note that under Windows 95, only 8x8 pixel large stipple bitmaps are supported, Windows 98 and NT as well as GTK support arbitrary bitmaps. .. seealso:: `wx.Bitmap `_ -------- .. method:: SetStyle(style) Sets the brush style. **Parameters:** * `style` (int): One of: ========================== ================================ ``wx.TRANSPARENT`` Transparent (no fill). ``wx.SOLID`` Solid. ``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. ``wx.STIPPLE`` Stippled using a bitmap. ``wx.STIPPLE_MASK_OPAQUE`` Stippled using a bitmap's mask. ========================== ================================ .. seealso:: `GetStyle <#GetStyle>`_ -------- Properties ^^^^^^^^^^ .. attribute:: Colour See `GetColour <#GetColour>`_ and `SetColour <#SetColour>`_ .. attribute:: Stipple See `GetStipple <#GetStipple>`_ and `SetStipple <#SetStipple>`_ .. attribute:: Style See `GetStyle <#GetStyle>`_ and `SetStyle <#SetStyle>`_