Menu Icon + Accelerator

I am trying to set an icon and accelerator for a menu item.

I can get either the icon or the accelerator working, but not both at the
same time. I am running on GTK using wxPython 2.4.1.2.

Here is the code I am using:

def setItem(self,image,title):
   menuId = wx.NewId()
   item = wx.MenuItem(self.menu,menuId,title)
   item.SetBitmap(image)
   self.menu.AppendItem(item)

If the title contains ('\tCtrl+N') then only the image displays. If the
image is wx.NullBitmap then the shortcut displays.

Can I get both working at the same time using GTK.

Regards
Gerrit van Dyk

I am trying to set an icon and accelerator for a menu item.

I can get either the icon or the accelerator working, but not both at the
same time. I am running on GTK using wxPython 2.4.1.2.

I submitted a patch for this a while ago (before 2.4.0 I think): I thought
it had been applied, but on any case you can find it on sf...

Alberto

Gerrit,
I experienced a similar effect. Actually, when I add something like item.SetBitmap(image)
to the item, the menu callback does not work at all any more.
peter

Alberto Griggio wrote:

I am trying to set an icon and accelerator for a menu item.

I can get either the icon or the accelerator working, but not both at the
same time. I am running on GTK using wxPython 2.4.1.2.

I submitted a patch for this a while ago (before 2.4.0 I think): I thought
it had been applied, but on any case you can find it on sf...

Do you still have a pointer to the patch? I expect that it was only applied to the 2.5 branch...

···

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