Hi,
while experimenting with menus I came across with the following
strange behaviour. While the following little wx-program is
supposed to call the function OnWhatIsThis when ALT+P is
pressed (which it does) it reacts also on my pressing simply the A-
Key, thus intercepting the char so that the TextCtrl will not show it.
I'm using Windows2000, no service pack, Python2.1 and wxPython
2.3. I am somewhat confused, seems to be a kind of bug...
Thanks
Christoph
···
#-----------------------------------------------------------------
from wxPython.wx import *
ID_WHATISTHIS = 101
class MyFrame(wxFrame):
def __init__(self, parent, ID, title):
wxFrame.__init__(self, parent, ID, title,
wxDefaultPosition, wxSize(200, 150))
menu = wxMenu()
menu.Append(ID_WHATISTHIS, "&Strange behaviour\tControl-
A")
menuBar = wxMenuBar()
menuBar.Append(menu, "&File");
self.SetMenuBar(menuBar)
t = wxTextCtrl(self, -1, "Test", wxDefaultPosition,
wxDefaultSize)
# set the menu accelerator table:
AT = wxAcceleratorTable([(wxACCEL_ALT, ord('P'),
ID_WHATISTHIS)])
self.SetAcceleratorTable(AT)
EVT_MENU(self, ID_WHATISTHIS, self.OnWhatIsThis)
def OnWhatIsThis(self, evt):
print "On What Is This"
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "Hello from wxPython")
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()
#--------------------------------------------------------