With Python 2.7 on Linux.
I’m creating MenuItem objects from a list of strings. I am setting the bitmap using wx.MenuItem.SetBitmap(), but the images are not showing on the popup menu.
This is my method on creating the PopupMenu:
def CreatePopupMenu(self, list):
self.menu = wxMenu()
i = 0
substring = self.GetLastWord()
for tableName in list:
if tableName.startswith(substring):
item = wx.MenuItem(self.menu, i, tableName)
item.SetBitmap(wx.Bitmap('a.png'))
self.menu.AppendItem(item)
i += 1
pos = self._Editor.PointFromPosition(self._Editor.GetCurrentPos())
pos.x += self._Editor.GetFont().GetPixelSize().width
pos.y += self._Editor.GetFont().GetPixelSize().height
self.Bind(wx.EVT_MENU, self.OnPopupItemSelected, item)
if self.menu.GetMenuItemCount() > 0:
#menuItem = self.menu.FindItemById(0)
self.PopupMenu(self.menu, pos)
self.menu.Destroy()
Kind awkward, but I found the answer to my own question. The problem is not language specific but a matter of gnome’ settings.
Apparently Gnome defaults to not enabling icons on menu items…
Found it here.
Thank you all!