[wxPython-users] Binding Menu Events

Phil Mayes phil at philmayes.com
Sat Mar 15 19:25:18 PDT 2008


At 06:08 PM 3/15/2008, you wrote:
>OK,
>
>Now I get the following error....on all menu events (close, edit, etc)
>Traceback (most recent call last):
>   File "MainWindow.py", line 39, in OnViewUser
>     text = self.m2f[item.GetId()]
>AttributeError: 'MainFrame' object has no attribute 'm2f'

Guess I was too brief...!  See my original post, where self.m2f is a 
dictionary mapping the menu IDs to the labels on the menu.  Basically, the 
idea is to save whatever info you want, referenced by the menu ID, then 
retrieve it in the menu handler.

Phil





More information about the wxpython-users mailing list