Phoenix Logo

phoenix_title wx.lib.platebtn.PlateButton

PlateButton is a custom type of flat button with support for displaying bitmaps and having an attached dropdown menu.


class_hierarchy Class Hierarchy

Inheritance diagram for class PlateButton:


super_classes Known Superclasses

wx.Control


method_summary Methods Summary

__init__ Create a PlateButton
AcceptsFocus Can this window have the focus?
Disable Disable the control
DoGetBestSize Calculate the best size of the button
Enable Enable/Disable the control
GetBackgroundBrush Get the brush for drawing the background of the button
GetBitmapDisabled Get the bitmap of the disable state
GetBitmapLabel Get the label bitmap
GetMenu Return the menu associated with this button or None if no
GetState Get the current state of the button
HasTransparentBackground Override setting of background fill
IsPressed Return if button is pressed (PB_STYLE_TOGGLE)
OnErase Trap the erase event to keep the background transparent
OnFocus Set the visual focus state if need be
OnKeyUp Execute a single button press action when the Return key is pressed
OnKillFocus Set the visual state back to normal when focus is lost
OnLeftDown Sets the pressed state and depending on the click position will
OnLeftUp Post a button event if the control was previously in a
OnMenuClose Refresh the control to a proper state after the menu has been
SetBitmap Set the bitmap displayed in the button
SetBitmapDisabled Set the bitmap for the disabled state
SetFocus Set this control to have the focus
SetFont Adjust size of control when font changes
SetLabel Set the label of the button
SetLabelColor Set the color of the label. The optimal label color is usually
SetMenu Set the menu that can be shown when clicking on the
SetPressColor Set the color used for highlighting the pressed state
SetWindowStyle Sets the window style bytes, the updates take place
SetWindowVariant Set the variant/font size of this control
ShouldInheritColours Overridden base class virtual. If the parent has non-default
ShowMenu Show the dropdown menu if one is associated with this control

property_summary Properties Summary

BitmapDisabled  
BitmapFocus  
BitmapHover  
BitmapLabel  
BitmapSelected  
LabelText  

api Class API



class PlateButton(wx.Control)

PlateButton is a custom type of flat button with support for displaying bitmaps and having an attached dropdown menu.


Methods



__init__(self, parent, id=wx.ID_ANY, label='', bmp=None, pos=wx.DefaultPosition, size=wx.DefaultSize, style=PB_STYLE_DEFAULT, name=wx.ButtonNameStr)

Create a PlateButton

Parameters:
  • label (string) – Buttons label text
  • bmp (wx.Bitmap) – Buttons bitmap
  • style – Button style


AcceptsFocus(self)

Can this window have the focus?



Disable(self)

Disable the control



DoGetBestSize(self)

Calculate the best size of the button

Returns:wx.Size


Enable(self, enable=True)

Enable/Disable the control



GetBackgroundBrush(self, dc)

Get the brush for drawing the background of the button

Returns:wx.Brush
..note::
used internally when on gtk


GetBitmapDisabled(self)

Get the bitmap of the disable state

Returns:wx.Bitmap or None


GetBitmapLabel(self)

Get the label bitmap

Returns:wx.Bitmap or None


GetMenu(self)

Return the menu associated with this button or None if no menu is associated with it.



GetState(self)

Get the current state of the button

Returns:int

See also

PLATE_NORMAL, PLATE_HIGHLIGHT, PLATE_PRESSED



HasTransparentBackground(self)

Override setting of background fill



IsPressed(self)

Return if button is pressed (PB_STYLE_TOGGLE)

Returns:bool


OnErase(self, evt)

Trap the erase event to keep the background transparent on windows.

Parameters:evt – wx.EVT_ERASE_BACKGROUND


OnFocus(self, evt)

Set the visual focus state if need be



OnKeyUp(self, evt)

Execute a single button press action when the Return key is pressed and this control has the focus.

Parameters:evt – wx.EVT_KEY_UP


OnKillFocus(self, evt)

Set the visual state back to normal when focus is lost unless the control is currently in a pressed state.



OnLeftDown(self, evt)

Sets the pressed state and depending on the click position will show the popup menu if one has been set.



OnLeftUp(self, evt)

Post a button event if the control was previously in a pressed state.

Parameters:evtwx.MouseEvent


OnMenuClose(self, evt)

Refresh the control to a proper state after the menu has been dismissed.

Parameters:evt – wx.EVT_MENU_CLOSE


SetBitmap(self, bmp)

Set the bitmap displayed in the button

Parameters:bmpwx.Bitmap


SetBitmapDisabled(self, bmp)

Set the bitmap for the disabled state

Parameters:bmpwx.Bitmap


SetFocus(self)

Set this control to have the focus



SetFont(self, font)

Adjust size of control when font changes



SetLabel(self, label)

Set the label of the button

Parameters:label (string) – label string


SetLabelColor(self, normal, hlight=wx.NullColour)

Set the color of the label. The optimal label color is usually automatically selected depending on the button color. In some cases the colors that are chosen may not be optimal.

The normal state must be specified, if the other two params are left Null they will be automatically guessed based on the normal color. To prevent this automatic color choices from happening either specify a color or None for the other params.

Parameters:


SetMenu(self, menu)

Set the menu that can be shown when clicking on the drop arrow of the button.

Parameters:menu (wx.Menu) – wx.Menu to use as a PopupMenu

Note

Arrow is not drawn unless a menu is set



SetPressColor(self, color)

Set the color used for highlighting the pressed state

Parameters:color (wx.Colour) – wx.Colour

Note

also resets all text colours as necessary



SetWindowStyle(self, style)

Sets the window style bytes, the updates take place immediately no need to call refresh afterwards.

Parameters:style – bitmask of PB_STYLE_* values


SetWindowVariant(self, variant)

Set the variant/font size of this control



ShouldInheritColours(self)

Overridden base class virtual. If the parent has non-default colours then we want this control to inherit them.



ShowMenu(self)

Show the dropdown menu if one is associated with this control