.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. currentmodule:: wx.lib.platebtn .. highlight:: python .. _wx.lib.platebtn.PlateButton: ========================================================================================================================================== |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 ================================= .. raw:: html
Inheritance diagram for class PlateButton:
| |super_classes| Known Superclasses ================================== :class:`wx.Control` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.platebtn.PlateButton.__init__` Create a PlateButton :meth:`~wx.lib.platebtn.PlateButton.AcceptsFocus` Can this window have the focus? :meth:`~wx.lib.platebtn.PlateButton.Disable` Disable the control :meth:`~wx.lib.platebtn.PlateButton.DoGetBestSize` Calculate the best size of the button :meth:`~wx.lib.platebtn.PlateButton.Enable` Enable/Disable the control :meth:`~wx.lib.platebtn.PlateButton.GetBackgroundBrush` Get the brush for drawing the background of the button :meth:`~wx.lib.platebtn.PlateButton.GetBitmapDisabled` Get the bitmap of the disable state :meth:`~wx.lib.platebtn.PlateButton.GetBitmapLabel` Get the label bitmap :meth:`~wx.lib.platebtn.PlateButton.GetMenu` Return the menu associated with this button or None if no :meth:`~wx.lib.platebtn.PlateButton.GetState` Get the current state of the button :meth:`~wx.lib.platebtn.PlateButton.HasTransparentBackground` Override setting of background fill :meth:`~wx.lib.platebtn.PlateButton.IsPressed` Return if button is pressed (PB_STYLE_TOGGLE) :meth:`~wx.lib.platebtn.PlateButton.OnErase` Trap the erase event to keep the background transparent :meth:`~wx.lib.platebtn.PlateButton.OnFocus` Set the visual focus state if need be :meth:`~wx.lib.platebtn.PlateButton.OnKeyUp` Execute a single button press action when the Return key is pressed :meth:`~wx.lib.platebtn.PlateButton.OnKillFocus` Set the visual state back to normal when focus is lost :meth:`~wx.lib.platebtn.PlateButton.OnLeftDown` Sets the pressed state and depending on the click position will :meth:`~wx.lib.platebtn.PlateButton.OnLeftUp` Post a button event if the control was previously in a :meth:`~wx.lib.platebtn.PlateButton.OnMenuClose` Refresh the control to a proper state after the menu has been :meth:`~wx.lib.platebtn.PlateButton.SetBitmap` Set the bitmap displayed in the button :meth:`~wx.lib.platebtn.PlateButton.SetBitmapDisabled` Set the bitmap for the disabled state :meth:`~wx.lib.platebtn.PlateButton.SetFocus` Set this control to have the focus :meth:`~wx.lib.platebtn.PlateButton.SetFont` Adjust size of control when font changes :meth:`~wx.lib.platebtn.PlateButton.SetLabel` Set the label of the button :meth:`~wx.lib.platebtn.PlateButton.SetLabelColor` Set the color of the label. The optimal label color is usually :meth:`~wx.lib.platebtn.PlateButton.SetMenu` Set the menu that can be shown when clicking on the :meth:`~wx.lib.platebtn.PlateButton.SetPressColor` Set the color used for highlighting the pressed state :meth:`~wx.lib.platebtn.PlateButton.SetWindowStyle` Sets the window style bytes, the updates take place :meth:`~wx.lib.platebtn.PlateButton.SetWindowVariant` Set the variant/font size of this control :meth:`~wx.lib.platebtn.PlateButton.ShouldInheritColours` Overridden base class virtual. If the parent has non-default :meth:`~wx.lib.platebtn.PlateButton.ShowMenu` Show the dropdown menu if one is associated with this control ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.lib.platebtn.PlateButton.BitmapDisabled` :attr:`~wx.lib.platebtn.PlateButton.BitmapFocus` :attr:`~wx.lib.platebtn.PlateButton.BitmapHover` :attr:`~wx.lib.platebtn.PlateButton.BitmapLabel` :attr:`~wx.lib.platebtn.PlateButton.BitmapSelected` :attr:`~wx.lib.platebtn.PlateButton.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. .. method:: __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 :keyword string `label`: Buttons label text :keyword wx.Bitmap `bmp`: Buttons bitmap :keyword `style`: Button style .. method:: AcceptsFocus(self) Can this window have the focus? .. method:: Disable(self) Disable the control .. method:: DoGetBestSize(self) Calculate the best size of the button :return: :class:`wx.Size` .. method:: Enable(self, enable=True) Enable/Disable the control .. method:: GetBackgroundBrush(self, dc) Get the brush for drawing the background of the button :return: :class:`wx.Brush` ..note:: used internally when on gtk .. method:: GetBitmapDisabled(self) Get the bitmap of the disable state :return: :class:`wx.Bitmap` or None .. method:: GetBitmapLabel(self) Get the label bitmap :return: :class:`wx.Bitmap` or None .. method:: GetMenu(self) Return the menu associated with this button or None if no menu is associated with it. .. method:: GetState(self) Get the current state of the button :return: int .. seeAlso:: PLATE_NORMAL, PLATE_HIGHLIGHT, PLATE_PRESSED .. method:: HasTransparentBackground(self) Override setting of background fill .. method:: IsPressed(self) Return if button is pressed (PB_STYLE_TOGGLE) :return: bool .. method:: OnErase(self, evt) Trap the erase event to keep the background transparent on windows. :param `evt`: wx.EVT_ERASE_BACKGROUND .. method:: OnFocus(self, evt) Set the visual focus state if need be .. method:: OnKeyUp(self, evt) Execute a single button press action when the Return key is pressed and this control has the focus. :param `evt`: wx.EVT_KEY_UP .. method:: OnKillFocus(self, evt) Set the visual state back to normal when focus is lost unless the control is currently in a pressed state. .. method:: OnLeftDown(self, evt) Sets the pressed state and depending on the click position will show the popup menu if one has been set. .. method:: OnLeftUp(self, evt) Post a button event if the control was previously in a pressed state. :param `evt`: :class:`wx.MouseEvent` .. method:: OnMenuClose(self, evt) Refresh the control to a proper state after the menu has been dismissed. :param `evt`: wx.EVT_MENU_CLOSE .. method:: SetBitmap(self, bmp) Set the bitmap displayed in the button :param `bmp`: :class:`wx.Bitmap` .. method:: SetBitmapDisabled(self, bmp) Set the bitmap for the disabled state :param `bmp`: :class:`wx.Bitmap` .. method:: SetFocus(self) Set this control to have the focus .. method:: SetFont(self, font) Adjust size of control when font changes .. method:: SetLabel(self, label) Set the label of the button :param string `label`: label string .. method:: 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. :param wx.Colour `normal`: Label color for normal state (:class:`wx.Colour`) :keyword wx.Colour `hlight`: Color for when mouse is hovering over .. method:: SetMenu(self, menu) Set the menu that can be shown when clicking on the drop arrow of the button. :param wx.Menu `menu`: :class:`wx.Menu` to use as a PopupMenu .. note:: Arrow is not drawn unless a menu is set .. method:: SetPressColor(self, color) Set the color used for highlighting the pressed state :param wx.Colour `color`: :class:`wx.Colour` .. note:: also resets all text colours as necessary .. method:: SetWindowStyle(self, style) Sets the window style bytes, the updates take place immediately no need to call refresh afterwards. :param `style`: bitmask of PB_STYLE_* values .. method:: SetWindowVariant(self, variant) Set the variant/font size of this control .. method:: ShouldInheritColours(self) Overridden base class virtual. If the parent has non-default colours then we want this control to inherit them. .. method:: ShowMenu(self) Show the dropdown menu if one is associated with this control