wx.lib.agw.buttonpanel.BPArt¶
BPArt
is an art provider class which does all of the drawing for ButtonPanel
.
This allows the library caller to customize the BPArt
or to completely replace
all drawing with custom BPArts.
Class Hierarchy¶
Methods Summary¶
Default class constructor. |
|
Draws a button in |
|
Paint the |
|
Draws the main caption text in |
|
Draws the label for a button. |
|
Draws a separator in |
|
Gradient fill from colour 1 to colour 2 with top to bottom or left to right. |
|
Returns the option value for the specified colour |
|
Returns the option value for the specified font |
|
Returns the gradient type for |
|
Returns the option value for the specified size |
|
Sets the option value for the specified colour |
|
Sets the option value for the specified font |
|
Sets the gradient type for |
|
Sets the option value for the specified size |
Class API¶
- class BPArt(object)¶
BPArt
is an art provider class which does all of the drawing forButtonPanel
. This allows the library caller to customize theBPArt
or to completely replace all drawing with custom BPArts.
Methods¶
- __init__(self, parentStyle)¶
Default class constructor.
- Parameters:
parentStyle (integer) – the window style for
ButtonPanel
.
- DrawButton(self, dc, rect, buttonBitmap, isVertical, buttonStatus, isToggled, textAlignment, text='')¶
Draws a button in
ButtonPanel
, together with its text (if any).- Parameters:
dc – an instance of
wx.DC
;rect (wx.Rect) – the button client rectangle;
buttonBitmap (wx.Bitmap) – the bitmap associated with the button;
isVertical (bool) –
True
ifButtonPanel
is in vertical orientation,False
otherwise;buttonStatus (string) – one of “Normal”, “Toggled”, “Pressed”, “Disabled” or “Hover”;
isToggled (bool) – whether the button is toggled or not;
textAlignment (integer) – the text alignment inside the button;
text (string) – the button label.
- DrawButtonPanel(self, dc, rect, style)¶
Paint the
ButtonPanel
’s background.- Parameters:
dc – an instance of
wx.DC
;rect (wx.Rect) – the
ButtonPanel
client rectangle;style (integer) – the
ButtonPanel
window style.
- DrawCaption(self, dc, rect, captionText)¶
Draws the main caption text in
ButtonPanel
.
- DrawLabel(self, dc, text, isEnabled, xpos, ypos)¶
Draws the label for a button.
- Parameters:
dc – an instance of
wx.DC
;text (string) – the button label;
isEnabled (bool) –
True
if the button is enabled,False
otherwise;xpos (integer) – the text x position inside the button;
ypos (integer) – the text y position inside the button.
- DrawSeparator(self, dc, rect, isVertical)¶
Draws a separator in
ButtonPanel
.- Parameters:
dc – an instance of
wx.DC
;rect (wx.Rect) – the separator client rectangle;
isVertical (bool) –
True
ifButtonPanel
is in vertical orientation,False
otherwise.
- FillGradientColour(self, dc, rect)¶
Gradient fill from colour 1 to colour 2 with top to bottom or left to right.
- Parameters:
dc – an instance of
wx.DC
;rect (wx.Rect) – the
ButtonPanel
client rectangle.
- GetColour(self, id)¶
Returns the option value for the specified colour
id
.- Parameters:
id (integer) –
the identification bit for the colour value. This can be one of the following bits:
Colour Id
Value
Description
BP_BACKGROUND_COLOUR
0
Background brush colour when no gradient shading exists
BP_GRADIENT_COLOUR_FROM
1
Starting gradient colour, used only when
BP_USE_GRADIENT
style is appliedBP_GRADIENT_COLOUR_TO
2
Ending gradient colour, used only when
BP_USE_GRADIENT
style is appliedBP_BORDER_COLOUR
3
Pen colour to paint the border of
ButtonPanel
BP_TEXT_COLOUR
4
Main
ButtonPanel
caption colourBP_BUTTONTEXT_COLOUR
5
Text colour for buttons with text
BP_BUTTONTEXT_INACTIVE_COLOUR
6
Text colour for inactive buttons with text
BP_SELECTION_BRUSH_COLOUR
7
Brush colour to be used when hovering or selecting a button
BP_SELECTION_PEN_COLOUR
8
Pen colour to be used when hovering or selecting a button
BP_SEPARATOR_COLOUR
9
Pen colour used to paint the separators
- Returns:
An instance of
wx.Colour
for the inputid
.- Raise:
Exception if the
id
is not recognized.
- GetFont(self, id)¶
Returns the option value for the specified font
id
.- Parameters:
id (integer) –
the identification bit for the font value. This can be one of the following bits:
Size Id
Value
Description
BP_TEXT_FONT
10
Font of the
ButtonPanel
main captionBP_BUTTONTEXT_FONT
11
Text font for the buttons with text
- Returns:
An instance of
wx.Font
for the inputid
.- Raise:
Exception if the
id
is not recognized.
- GetGradientType(self)¶
Returns the gradient type for
BPArt
drawings.- Returns:
An integer representing the gradient type.
See also
SetGradientType
for a list of possible gradient types.
- GetMetric(self, id)¶
Returns the option value for the specified size
id
.- Parameters:
id (integer) –
the identification bit for the size value. This can be one of the following bits:
Size Id
Value
Description
BP_SEPARATOR_SIZE
14
Separator size. Note: This is not the line width, but the sum of the space before and after the separator line plus the width of the line
BP_MARGINS_SIZE
15
Size of the left/right margins in
ButtonPanel
(top/bottom for vertically alignedButtonPanel
)BP_BORDER_SIZE
16
Size of the border
BP_PADDING_SIZE
17
Inter-tool separator size
- Returns:
An integer representing the option value for the input
id
.- Raise:
Exception if the
id
is not recognized.
- SetColour(self, id, colour)¶
Sets the option value for the specified colour
id
.- Parameters:
id (integer) – the identification bit for the colour value;
colour – the new value for the colour (a valid
wx.Colour
instance).
- Raise:
Exception if the
id
is not recognized.
See also
GetColour
for a list of meaningful colour ids.
- SetFont(self, id, font)¶
Sets the option value for the specified font
id
.- Parameters:
id (integer) – the identification bit for the font value;
colour – the new value for the font (a valid
wx.Font
instance).
- Raise:
Exception if the
id
is not recognized.
See also
GetFont
for a list of meaningful font ids.
- SetGradientType(self, gradient)¶
Sets the gradient type for
BPArt
drawings.- Parameters:
gradient (integer) – can be one of the following bits:
Gradient Type
Value
Description
BP_GRADIENT_NONE
0
No gradient shading should be used to paint the background
BP_GRADIENT_VERTICAL
1
Vertical gradient shading should be used to paint the background
BP_GRADIENT_HORIZONTAL
2
Horizontal gradient shading should be used to paint the background