I fear this is a dumb question, but that never stopped me before...
Is there a simple way to monitor all events emitted by a particular
widget and perhaps print the name of the event that was sent.
Use case: I'm working with a control I've never touched before
(DataViewListCtrl) which has lots of events for which the descriptions
in the docs all seem very similar. So I don't know what to Bind().
Would be nice if I could just create the widget, poke it a bit, and
see what comes out.
Thanks,
Michael
Just tried a little experiment:
Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit
(Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
import wx
e=wx.Event
dir(e)
['ClassName', 'Clone', 'Destroy', 'EventObject', 'EventType',
'GetClassName', 'G
etEventObject', 'GetEventType', 'GetId', 'GetSkipped', 'GetTimestamp',
'Id', 'Is
CommandEvent', 'IsSameAs', 'ResumePropagation', 'SetEventObject',
'SetEventType'
, 'SetId', 'SetTimestamp', 'ShouldPropagate', 'Skip', 'Skipped',
'StopPropagatio
n', 'Timestamp', '__class__', '__del__', '__delattr__', '__dict__',
'__doc__', '
__format__', '__getattribute__', '__hash__', '__init__', '__module__',
'__new__'
, '__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
'__sizeof__', '__str
__', '__subclasshook__', '__swig_destroy__', '__weakref__', 'thisown']
help(e.GetEventType)
Help on method GetEventType in module wx._core:
GetEventType(*args, **kwargs) unbound wx._core.Event method
GetEventType(self) -> EventType
Returns the identifier of the given event type, such as
``wxEVT_COMMAND_BUTTON_CLICKED``.
So if you bind an a single event handler to all the events for your
control you can print out the event types from within the handler...
Gadget/Steve
···
On 24/02/2012 3:42 PM, Michael Hipp wrote: