[wxpython-users] accelerator newbie, help

Phillip Watts phillip.watts at anvilcom.com
Thu Apr 24 06:07:16 PDT 2008


Re the winxp event problem, it was suggested
what I really want is an acceleratortable so I
coded this simple test (within a gui app)

def altx():
       print 'altx'
def dof3():
       print 'dof3'

aTable = wx.AcceleratorTable([(wx.ACCEL_ALT,  ord('X'), altx),
                              (wx.ACCEL_NORMAL, wx.WXK_F3, dof3),
                              ])
SetAcceleratorTable(aTable)

AND GOT: 
File "./wintest.py", line 69, in <module>
    (wx.ACCEL_NORMAL, wx.WXK_F3, dof3),
  File "/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", 
line 7986, in __init__
    newobj = _core_.new_AcceleratorTable(*args, **kwargs)
TypeError: an integer is required

altx should be a cmdID.  How do I code that to call the event handler?

Does acceleratortable only work with menus?  If so no good.
this must work on linux, win, maybe mac.
Thanks.


More information about the wxpython-users mailing list