Monday, October 1, 2007

What are all the wxPython Events?

On several occasions recently I found did not know what event to specify to trigger something in my wxPython apps. I had a hard time finding anything close to a comprehensive list of all events available, so I was limited to posting questions on the wxPython users mailing list. And, while this is a wonderful and active list, it would be nice to have a guide even closer at hand.

Cody Precord on the list provided me with a handy way to get this:
import wx

for x in dir(wx):
if x.startswith('EVT_'):
print x
Run that, and out comes a list of all the EVT types. Of course, in some cases you may not know what the event is just from the name, but they are mostly suitable self-explanatory. See for yourself:

EVT_ACTIVATE
EVT_ACTIVATE_APP
EVT_BUTTON
EVT_CALCULATE_LAYOUT
EVT_CHAR
EVT_CHAR_HOOK
EVT_CHECKBOX

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home