Phoenix Logo

phoenix_title 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 Class Hierarchy

Inheritance diagram for class BPArt:


method_summary Methods Summary

__init__ Default class constructor.
DrawButton Draws a button in ButtonPanel, together with its text (if any).
DrawButtonPanel Paint the ButtonPanel‘s background.
DrawCaption Draws the main caption text in ButtonPanel.
DrawLabel Draws the label for a button.
DrawSeparator Draws a separator in ButtonPanel.
FillGradientColour Gradient fill from colour 1 to colour 2 with top to bottom or left to right.
GetColour Returns the option value for the specified colour id.
GetFont Returns the option value for the specified font id.
GetGradientType Returns the gradient type for BPArt drawings.
GetMetric Returns the option value for the specified size id.
SetColour Sets the option value for the specified colour id.
SetFont Sets the option value for the specified font id.
SetGradientType Sets the gradient type for BPArt drawings.
SetMetric Sets the option value for the specified size id.

api Class API



class BPArt(object)

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.


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 if ButtonPanel 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:


DrawCaption(self, dc, rect, captionText)

Draws the main caption text in ButtonPanel.

Parameters:
  • dc – an instance of wx.DC;
  • rect (wx.Rect) – the main caption text rectangle;
  • captionText (string) – the caption text string.


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 if ButtonPanel 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:


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 applied
BP_GRADIENT_COLOUR_TO 2 Ending gradient colour, used only when BP_USE_GRADIENT style is applied
BP_BORDER_COLOUR 3 Pen colour to paint the border of ButtonPanel
BP_TEXT_COLOUR 4 Main ButtonPanel caption colour
BP_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 input id.
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 caption
BP_BUTTONTEXT_FONT 11 Text font for the buttons with text
Returns:An instance of wx.Font for the input id.
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 aligned ButtonPanel)
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


SetMetric(self, id, new_val)

Sets the option value for the specified size id.

Parameters:
  • id (integer) – the identification bit for the size value;
  • new_val (integer) – the new value for the size.
Raise:

Exception if the id is not recognized.

See also

GetMetric for a list of meaningful size ids.