This module implements various forms of generic checkboxes, meaning that they are not built on native controls but are self-drawn.
This module implements various forms of generic checkboxes, meaning that they are not built on native controls but are self-drawn. They should act like normal checkboxes but you are able to better control how they look, etc…
Sample usage:
app = wx.App(redirect=False)
class MyFrame(wx.Frame, DefineNativeCheckBoxBitmapsMixin):
def __init__(self, parent, id=wx.ID_ANY, title="",
pos=wx.DefaultPosition, size=wx.DefaultSize,
style=wx.DEFAULT_FRAME_STYLE, name='frame'):
wx.Frame.__init__(self, parent, id, title, pos, size, style, name)
## self.DefineNativeCheckBoxBitmaps()
## self.checkbox_bitmaps = self.GetNativeCheckBoxBitmaps()
cb1 = GenCheckBox(self, label="PurePython Checkbox1", pos=(10, 10))
cb2 = GenCheckBox(self, label="PurePython Checkbox2", pos=(10, 50))
cb1.Bind(wx.EVT_CHECKBOX, self.OnCheckBox)
cb2.Bind(wx.EVT_CHECKBOX, self.OnCheckBox)
cb2.SetForegroundColour(wx.GREEN)
cb2.SetBackgroundColour(wx.BLACK)
sizer = wx.BoxSizer()
sizer.Add(cb1, 0, wx.ALL, 5)
sizer.Add(cb2, 0, wx.ALL, 5)
self.SetSizer(sizer)
def OnCheckBox(self, event):
evtObj = event.GetEventObject()
print(evtObj.GetLabel(), evtObj.IsChecked())
frame = MyFrame(None, wx.ID_ANY, "Test Pure-Py Checkbox")
frame.Show()
app.MainLoop()
Inherit this mixin in your |
|
A generic class that replicates some of the functionalities of |