PlateButton is a custom type of flat button with support for displaying bitmaps and having an attached dropdown menu.
Create a PlateButton |
|
Can this window have the focus? |
|
Disable the control |
|
Calculate the best size of the button |
|
Enable/Disable the control |
|
Get the brush for drawing the background of the button |
|
Get the bitmap of the disable state |
|
Get the label bitmap |
|
Return the menu associated with this button or None if no |
|
Get the current state of the button |
|
Override setting of background fill |
|
Return if button is pressed (PB_STYLE_TOGGLE) |
|
Trap the erase event to keep the background transparent |
|
Set the visual focus state if need be |
|
Execute a single button press action when the Return key is pressed |
|
Set the visual state back to normal when focus is lost |
|
Sets the pressed state and depending on the click position will |
|
Post a button event if the control was previously in a |
|
Refresh the control to a proper state after the menu has been |
|
Set the bitmap displayed in the button |
|
Set the bitmap for the disabled state |
|
Set this control to have the focus |
|
Adjust size of control when font changes |
|
Set the label of the button |
|
Set the color of the label. The optimal label color is usually |
|
Set the menu that can be shown when clicking on the |
|
Set the color used for highlighting the pressed state |
|
Sets the window style bytes, the updates take place |
|
Set the variant/font size of this control |
|
Overridden base class virtual. If the parent has non-default |
|
Show the dropdown menu if one is associated with this control |
|
|
|
|
|
|
|
|
|
|
|
PlateButton
(wx.Control)¶PlateButton is a custom type of flat button with support for displaying bitmaps and having an attached dropdown menu.
__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
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
Enable
(self, enable=True)¶Enable/Disable the control
GetBackgroundBrush
(self, dc)¶Get the brush for drawing the background of the button
used internally when on gtk
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
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)
bool
OnErase
(self, evt)¶Trap the erase event to keep the background transparent on windows.
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.
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.
evt – wx.MouseEvent
OnMenuClose
(self, evt)¶Refresh the control to a proper state after the menu has been dismissed.
evt – wx.EVT_MENU_CLOSE
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
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.
SetMenu
(self, menu)¶Set the menu that can be shown when clicking on the drop arrow of the button.
Note
Arrow is not drawn unless a menu is set
SetPressColor
(self, color)¶Set the color used for highlighting the pressed state
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.
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