ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxpython-users
wxpython-users
[wxpython-users] Re: Newbie question re:wxMenuBar events
by Randy Rue other posts by this author
May 7 2008 12:45PM messages near this date
Re: [wxpython-users] has_key() method versus the 'in' statement | [wxpython-users] Re: Newbie question re:wxMenuBar events
In the wxGlade dialog for editing menu items there is an "id" field for
items. I had left it blank and I believe that's why each item had an id of
"-1" (I think this prompts the code to auto-assign some id to these
objects). On the guess that this "id" field might actually name that menu
choice (i.e. you might have a button called enable_ssl_button that kicks off
a function called enable_ssl), I entered an id ("close_cw_menu_item") for
the close_cw menu item. Then when I generate code, running it returns a
squawk "NameError: global name 'close_cw_menu_item' is not defined....


> 
>  ---------- Forwarded message ----------
>  From: Christopher Barker <Chris.Barker@[...].gov>
>  To: wxpython-users@[...].org
>  Date: Wed, 07 May 2008 11:58:44 -0700
>  Subject: Re: [wxpython-users] Newbie question re:wxMenuBar events
>  Gre7g Luterman wrote:
> 
>  > if I were writing this code by hand, each item would look more like:
>  >  ID_BUY = wx.NewId()
>  > wxglade_tmp_menu.Append(ID_BUY, "Buy CW", "", wx.ITEM_NORMAL)
>  > self.Bind(wx.EVT_MENU, self.buy_license, id=ID_BUY)
>  >
> 
>  I'd do:
> 
>  item = wxglade_tmp_menu.Append(wx.ID_ANY, "Buy CW", "", wx.ITEM_NORMAL)
>  self.Bind(wx.EVT_MENU, self.buy_license, item)
> 
>  see:
>  http://wiki.wxpython.org/wxPython%20Style%20Guide
> 
>  I really don't like IDs. I do wish you could just do:
> 
>  Menu_Item.Bind(...)
> 
>  But such is life.
> 
>  -Chris
> 
> 
>  --
>  Christopher Barker, Ph.D.
>  Oceanographer
> 
>  Emergency Response Division
>  NOAA/NOS/OR&R            (206) 526-6959   voice
>  7600 Sand Point Way NE   (206) 526-6329   fax
>  Seattle, WA  98115       (206) 526-6317   main reception
> 
>  Chris.Barker@[...].gov
> 
> 
>  _______________________________________________
>  wxpython-users mailing list
>  wxpython-users@[...].org
>  http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
> 
> 
Thread:
Randy Rue
Randy Rue
Robin Dunn
Mike Driscoll

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved