Intro
The PlateButton is a drop in replacement for a wx.BitmapButton that creates a flat button that supports showing any combination of a bitmap, label, and menu.
Api
# Constructor
button = PlateButton(parent, id_=wx.ID_ANY, label='', bmp=None,
pos=wx.DefaultPosition, size=wx.DefaultSize,
style=PB_STYLE_DEFAULT, name=wx.ButtonNameStr)
# Style Flags
PB_STYLE_DEFAULT # Normal Flat Background
PB_STYLE_GRADIENT # Gradient Filled Background
PB_STYLE_SQUARE # Use square corners instead of rounded
PB_STYLE_NOBG # Useful on Windows to get a transparent appearance
# when the control is shown on a non solid background
PB_STYLE_DROPARROW # Draw drop arrow and fire EVT_PLATEBTN_DROPRROW_PRESSED event
Example
import wx
import eclib
class MyPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_MENU)
self.pbutton = eclib.PlateButton(self, wx.ID_ANY, u"Hello", bmp)
sizer = wx.BoxSizer()
sizer.Add(self.pbutton, 0, wx.ALIGN_CENTER)
self.SetSizer(sizer)
self.Bind(wx.EVT_BUTTON, self.OnButton)
def OnButton(self, evt):
print "Event Id", evt.GetId()
Links