[wxPython-users] binding to both menu items and toolbar buttons

Robin Dunn robin at alldunn.com
Thu Sep 28 12:43:12 PDT 2006


John Salerno wrote:
> I was just reading in wxPython in Action that if a toolbar button has 
> the same ID as a menu item, then the Bind call for a menu item will work 
> for that button as well. Does this mean you don't have to create 
> separate Bind calls for the toolbar buttons?

Correct.

> 
> Also, I've never dealt with assigning IDs other than the default, so 
> does it matter what I choose here? Or can I just start numbering them at 1?

Use wx.NewId() to generate an ID value.  Or you can create the menu item 
with a default value and use item.GetId() for the toolbar item (or visa 
versa.)

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list