wx MenuItem - icon is missing

Laszlo Nagy gandalf at shopzeus.com
Tue Jul 5 04:02:13 EDT 2011


     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'

Thanks,

    Laszlo




More information about the Python-list mailing list