wx MenuItem - icon is missing
gandalf at shopzeus.com
Wed Jul 6 12:26:11 EDT 2011
> I can understand why it's frustrating but a menu items with icons on them aren't exactly common, so you're wandering into territory that's probably not so throughly explored (nor standard across platforms). Now that I think about it, I don't know that I've ever seen one under OSX, and I don't even know if it's supported at all.
Maybe you are right, I'm not familiar with OS X. But they are common in
GTK, Qt and Windows.
> Me, I would start by addressing the error in the traceback. wx doesn't seem happy with an orphan menu item; why not create a wx.Menu and assign the menu item to that? It might solve your icon problem; you never know.
I did create it:
menu = wx.Menu() # wx.Menu created here.
item = wx.MenuItem(None,-1,u"Test")
menu.AppendItem(item) # Item added to menu here.
> In defense of wxPython, we have three wx apps in our project and they contain very little platform-specific code. To be fair, we've had to rewrite some code after we found that it worked on one platform but not another, but generally we're able to find code that works on all platforms. We have only a couple of places where we were forced to resort to this kind of thing:
> if wx.Platform == "__WXGTK__":
> do X
> elif wx.Platform == "__WXMAC__":
> do Y
Hmmm then probably I'll have to install other OS too. :-)
More information about the Python-list