views:

72

answers:

2

I was wondering if there was a dictionary containing string versions of wxPython class (like 'Button' for wx.Button) to the events they call. This is what I want: {'Button': wx.EVT_BUTTON, ...}. Is there a dictionary like this anywhere in the module or on the web?

A: 

This is what I do (probably taken from the mailing list at some time):

for i in dir(wx):
    if i.startswith('EVT_'):
        print i

Clearly this isn't exactly what you're asking for, but the result is pretty intuitive to figure out what does what.

DrBloodmoney
A: 

wxGlade knows about this: For every Widget there is a class EditWidget derived from class ManagedBase that has a class attribute events holding the names of the events sent by Widget:

e.g. in widgets/bitmap_button/bitmap_button.py you'll find

class EditBitmapButton(ManagedBase):

    events = ['EVT_BUTTON']

You could collect the information you want by importing all these classes (can be done automatically, I think) and reading their events attribute.

Ber