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)¶
BPArtis an art provider class which does all of the drawing forButtonPanel. This allows the library caller to customize theBPArtor 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) –
TrueifButtonPanelis in vertical orientation,Falseotherwise;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
ButtonPanelclient rectangle;style (integer) – the
ButtonPanelwindow 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) –
Trueif the button is enabled,Falseotherwise;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) –
TrueifButtonPanelis in vertical orientation,Falseotherwise.
- 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
ButtonPanelclient 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_COLOUR0
Background brush colour when no gradient shading exists
BP_GRADIENT_COLOUR_FROM1
Starting gradient colour, used only when
BP_USE_GRADIENTstyle is appliedBP_GRADIENT_COLOUR_TO2
Ending gradient colour, used only when
BP_USE_GRADIENTstyle is appliedBP_BORDER_COLOUR3
Pen colour to paint the border of
ButtonPanelBP_TEXT_COLOUR4
Main
ButtonPanelcaption colourBP_BUTTONTEXT_COLOUR5
Text colour for buttons with text
BP_BUTTONTEXT_INACTIVE_COLOUR6
Text colour for inactive buttons with text
BP_SELECTION_BRUSH_COLOUR7
Brush colour to be used when hovering or selecting a button
BP_SELECTION_PEN_COLOUR8
Pen colour to be used when hovering or selecting a button
BP_SEPARATOR_COLOUR9
Pen colour used to paint the separators
- Returns:
An instance of
wx.Colourfor the inputid.- Raise:
Exception if the
idis 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_FONT10
Font of the
ButtonPanelmain captionBP_BUTTONTEXT_FONT11
Text font for the buttons with text
- Returns:
An instance of
wx.Fontfor the inputid.- Raise:
Exception if the
idis not recognized.
- GetGradientType(self)¶
Returns the gradient type for
BPArtdrawings.- Returns:
An integer representing the gradient type.
See also
SetGradientTypefor 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_SIZE14
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_SIZE15
Size of the left/right margins in
ButtonPanel(top/bottom for vertically alignedButtonPanel)BP_BORDER_SIZE16
Size of the border
BP_PADDING_SIZE17
Inter-tool separator size
- Returns:
An integer representing the option value for the input
id.- Raise:
Exception if the
idis 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.Colourinstance).
- Raise:
Exception if the
idis not recognized.
See also
GetColourfor 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.Fontinstance).
- Raise:
Exception if the
idis not recognized.
See also
GetFontfor a list of meaningful font ids.
- SetGradientType(self, gradient)¶
Sets the gradient type for
BPArtdrawings.- Parameters:
gradient (integer) – can be one of the following bits:
Gradient Type
Value
Description
BP_GRADIENT_NONE0
No gradient shading should be used to paint the background
BP_GRADIENT_VERTICAL1
Vertical gradient shading should be used to paint the background
BP_GRADIENT_HORIZONTAL2
Horizontal gradient shading should be used to paint the background