[wxPython-users] wxEvent.EventType

Robin Dunn robin at alldunn.com
Mon Jul 9 11:20:58 PDT 2007


Colin J. Williams wrote:
> Is there any utility function which interprets the bits of an event's 
> type into text?

No built-in but it's not hard to do it yourself.  Here's one way to make 
a map of all the EVT objects in the core wx module:


  >>>
  >>> evt_map = {}
  >>> for evt, name in [(getattr(wx,x), x) for x in dir(wx) if 
x.startswith('EVT_')]:
  ...     if isinstance(evt, wx.PyEventBinder):
  ...         evt_map[evt.typeId] = name
  ...
  >>>
  >>> wx.EVT_BUTTON.typeId
  10080
  >>> evt_map[10080]
  'EVT_BUTTON'
  >>>

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list