wx MenuItem - icon is missing

Philip Semanchuk philip at semanchuk.com
Tue Jul 5 14:50:23 CEST 2011


On Jul 5, 2011, at 4:02 AM, Laszlo Nagy wrote:

>    def onPopupMenu(self,evt):
>        menu = wx.Menu()
>        for title,bitmap in self.getPopupMenuItems():
>            item = wx.MenuItem(None,-1,title)
>            if bitmap:
>                item.SetBitmap(bitmap)
>            menu.AppendItem(item)
>            menu.Bind(wx.EVT_MENU,self.onPopupMenuItemSelected,item)
>        self.PopupMenu( menu, evt.GetPoint())
>        menu.Destroy()
> 
> I have read somewhere that under GTK, I have to assign the bitmap before Append-ing the MenuItem to the Menu. So did I, but it doesn't work. Menu item icons are not showing up in Ubuntu. On Windows 7, everything is fine. What am I doing wrong?
> 
> System: Ubuntu 11 amd64
> Python: 2.7.1+
> wx.__version__ '2.8.11.0'

Hi Laszlo,
Two suggestions --

1. Post a complete example that demonstrates the problem so that we don't have to dummy up a wx app ourselves to try your code.

2. Ask on the wxPython mailing list.

Good luck
Philip


More information about the Python-list mailing list