[wxpython-users] Adding Debug Logging For Events
Robin Dunn
robin at alldunn.com
Sun Mar 30 21:06:13 PDT 2008
Harry Goldschmitt wrote:
> I was writing some code to debug wxPython events by logging them. I ran
> into the problem that can only get to the number for the event type, not
> a human readable definition. Have I missed an interface?
No, but you can easily make your own. For example:
>>> def getEventTypeMap():
... types = [x for x in dir(wx) if x.startswith('wxEVT')]
... map = {}
... for t in types:
... map[getattr(wx, t)] = t
... return map
...
>>> m = getEventTypeMap()
>>>
>>>
>>> m[wx.EVT_BUTTON.typeId]
'wxEVT_COMMAND_BUTTON_CLICKED'
>>>
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list