Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9013

Re: wx MenuItem - icon is missing

Date 2011-07-06 18:26 +0200
From Laszlo Nagy <gandalf@shopzeus.com>
Subject Re: wx MenuItem - icon is missing
References (1 earlier) <8B072395-5E0C-49C7-BBC4-38BAD25D0C05@semanchuk.com> <4E1366D5.6030208@shopzeus.com> <D610BFCB-C437-4FDF-83BC-42779715347F@semanchuk.com> <4E13FFE1.1080303@shopzeus.com> <7ED1FBA3-1A84-4A5C-A3E7-3286A03405F4@semanchuk.com>
Newsgroups comp.lang.python
Message-ID <mailman.733.1310026861.1164.python-list@python.org> (permalink)

Show all headers | View raw


> 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")
         item.SetBitmap(img.GetBitmap())
         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
>     etc.
Hmmm then probably I'll have to install other OS too. :-)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: wx MenuItem - icon is missing Laszlo Nagy <gandalf@shopzeus.com> - 2011-07-06 18:26 +0200

csiph-web