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
from wx.lib.mixins import inspection
app = inspection.InspectableApp(0)
run your test app, ctrl-alt-i and start the Event Watcher
see in the wiki for more details on the WIT -
http://wiki.wxpython.org/Widget%20Inspection%20Tool
Werner
Thanks, I've been using the WIT for a long time but never noticed it had an
event monitor. After turning off all the SET_CURSOR events that buries it, I
think it will do what I need.
Thanks,
Michael
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
Unfortunately they will just be numbers at that point without any useful
meaning attached to them. They will need to be mapped back to their
EVT_ names to be recognizable by a human, and the event watcher in the
WIT does that for you. You can also use the EventWatcher independently
of the WIT if you want to, take a look at the wx.lib.eventwatcher module.
--
Robin Dunn
Software Craftsman
http://wxPython.org