[wxPython-users] menu IDs
Christopher Barker
Chris.Barker at noaa.gov
Wed Nov 1 09:41:26 PST 2006
I try to avoid IDs everywhere -- it just seems clunky to me. Why not =
just keep a reference to the menu item, rather than its ID:
menuEdit =3D wx.Menu()
self.edit_town =3D menuEdit.Append(wx.ID_ANY, text=3D"&Towns...")
self.edit_city =3D menuEdit.Append(wx.ID_ANY, text=3D"&Cities...")
then:
def refreshMenu(self):
...
edit_town =3D self.edit_town
edit_city =3D self.edit_city
...
if ncity > 0 :
edit_city.Enable(False)
else:
edit_city.Enable(True)
Enclosed is a working version.
By the way. In the future, please try to post a complete, self =
contained, working (as much as you can) sample app. That way we can =
tweak it and test it with little effort.
-Chris
-- =
Christopher Barker, Ph.D.
Oceanographer
=
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MenuDisable.py
Type: text/x-python
Size: 2061 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20061=
101/263e910b/MenuDisable.py
More information about the wxpython-users
mailing list