Pushing all the buttons
Even though the standard button can get the job done most of the time, there are other cases where you may want to provide a different look and feel for certain situations. So, in addition to the standard button, wxPython also has several other types of buttons that provide additional features to customize their look and feel.
How to do it…
You need to perform the following steps:
- Let's start simply by stubbing out our panel that will hold the buttons in this example through this code:
import wx import wx.lib.platebtn as platebtn class MyPanel(wx.Panel): def __init__(self, parent): super(MyPanel, self).__init__(parent) # Layout sizers vsizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.BoxSizer(wx.HORIZONTAL) vsizer.Add(sizer)
- Now, let's create a couple of
ToggleButton
controls, as follows:# Toggle Button toggle = wx.ToggleButton(self, label="Toggle Me") sizer.Add(toggle) ...