]> git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/test_buttonKeyHandler.py
style required on wxGTK
[wxWidgets.git] / wxPython / tests / test_buttonKeyHandler.py
1 import wx
2
3 BIND_HANDLERS = False
4 SKIP_EVENT = True
5
6 def OnKeyDown(evt):
7 print "OnKeyDown", evt.KeyCode
8 if SKIP_EVENT:
9 evt.Skip()
10
11 def OnKeyUp(evt):
12 print "OnKeyUp", evt.KeyCode
13 if SKIP_EVENT:
14 evt.Skip()
15
16 def OnChar(evt):
17 print "OnChar", evt.KeyCode
18 if SKIP_EVENT:
19 evt.Skip()
20
21
22 app = wx.App(False)
23 frm = wx.Frame(None, title="test_buttonKeyHandler")
24 pnl = wx.Panel(frm)
25
26 btn = wx.Button(pnl, label="Focus me and press a key", pos=(20,20))
27 if BIND_HANDLERS:
28 btn.Bind(wx.EVT_KEY_DOWN, OnKeyDown)
29 btn.Bind(wx.EVT_KEY_UP, OnKeyUp)
30 btn.Bind(wx.EVT_CHAR, OnChar)
31
32 frm.Show()
33 app.MainLoop()