def installWxMnemonicsCheckers(options):
# Buttons and menu entries must have keyboard mnemonics. Some static
# labels need them too, but we don't check for those at the moment.
try:
import wx
except ImportError:
return
class wxMnemonicsCheckedButton(wx.Button):
def __init__(self, parent, id=-1, label=wx.EmptyString, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, validator=wx.DefaultValidator, name=wx.ButtonNameStr):
if label and '&' not in label:
raise AssertionError('Button labels must have mnemonics')
super(wxMnemonicsCheckedButton, self).__init__(parent, id, label, pos, size, style, validator, name)
def Create(self, parent, id=-1, label=wx.EmptyString, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, validator=wx.DefaultValidator, name=wx.ButtonNameStr):
if label and '&' not in label:
raise AssertionError('Button labels must have mnemonics')
super(wxMnemonicsCheckedButton, self).Create(parent, id, label, pos, size, style, validator, name)
def SetLable(self, label):
if label and '&' not in label:
raise AssertionError('Button labels must have mnemonics')
super(wxMnemonicsCheckedButton, self).SetLabel(label)
wx.Button = wxMnemonicsCheckedButton