Combobox, menu id

Hello, I have two questions that I hope I can get answers. (I have already searched the list/googles archives for answers to no avail.)

  1. In wxPython 2.5, I use the function wx.NewId() to assign random id to menu’s. How do I retrieve this menu with GetId()?

E.g:

    self.menuFile.Append(wx.NewId(), "E&xit", "Quit this application.", wx.ITEM_NORMAL)

If I assign the ID to ID_EXIT I can retrieve it with:

    self.Bind( wx.EVT_MENU, self.OnMenuFileExit, id=ID_EXIT )

But, if I use wx.NewId(), I am at a loss…

  1. Is it possible to add an image + text to a combobox? How?

Thanks!!

Allever

Newbie - In Training

Allever wrote:

Hello, I have two questions that I hope I can get answers. (I have already searched the list/googles archives for answers to no avail.)
1) In wxPython 2.5, I use the function wx.NewId() to assign random id to menu's. How do I retrieve this menu with GetId()?
E.g:
        self.menuFile.Append(wx.NewId(), "E&xit", "Quit this application.", wx.ITEM_NORMAL)
If I assign the ID to ID_EXIT I can retrieve it with:
        self.Bind( wx.EVT_MENU, self.OnMenuFileExit, id=ID_EXIT )
But, if I use wx.NewId(), I am at a loss...

  item = self.menuFile.Append(wx.NewId(), "E&xit",
                   "Quit this application.", wx.ITEM_NORMAL)
  
Now you can use item.GetId(), or just bind it with the item as source, like this:

  self.Bind( wx.EVT_MENU, self.OnMenuFileExit, item )

Not with the native widgets.

···

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