Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8946 > unrolled thread
| Started by | Philip Semanchuk <philip@semanchuk.com> |
|---|---|
| First post | 2011-07-06 11:36 -0400 |
| Last post | 2011-07-07 17:37 +1200 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: wx MenuItem - icon is missing Philip Semanchuk <philip@semanchuk.com> - 2011-07-06 11:36 -0400
Re: wx MenuItem - icon is missing Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-07 17:37 +1200
| From | Philip Semanchuk <philip@semanchuk.com> |
|---|---|
| Date | 2011-07-06 11:36 -0400 |
| Subject | Re: wx MenuItem - icon is missing |
| Message-ID | <mailman.702.1309966578.1164.python-list@python.org> |
On Jul 6, 2011, at 2:25 AM, Laszlo Nagy wrote:
>
>>> Under windows, this displays the icon for the popup menu item. Under GTK it doesn't and there is no error message, no exception.
>>
>> I get different results than you.
>>
>> Under Ubuntu 9.04 w with wx 2.8.9.1, when I right click I see a menu item called test with little icon of a calculator or something.
>>
>> Under OS X 10.6 with wx 2.8.12.0 and Win XP with wx 2.8.10.1, when I right click I get this --
>>
>> Traceback (most recent call last):
>> File "x.py", line 46, in onPopupMenu
>> item = wx.MenuItem(None,-1,u"Test")
>> File "/usr/local/lib/wxPython-unicode-2.8.12.0/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 11481, in __init__
>> _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
>> wx._core.PyAssertionError: C++ assertion "parentMenu != NULL" failed at /BUILD/wxPython-src-2.8.12.0/src/common/menucmn.cpp(389) in wxMenuItemBase(): menuitem should have a menu
> I guess I'll have to write to the wxPython mailing list. Seriously, adding a simple menu to something is supposed to be platform independent, but we got four different results on four systems. :-(
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.
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.
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.
> Thank you for trying out though.
You're welcome. VirtualBox helped.
bye
Philip
[toc] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2011-07-07 17:37 +1200 |
| Message-ID | <97kv1mFmrkU1@mid.individual.net> |
| In reply to | #8946 |
Philip Semanchuk wrote: > I can understand why it's frustrating but a menu items with icons on them > aren't exactly common... 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. It's supported -- I've got FruitMenu running at the moment and it makes fairly heavy use of them. I agree that they don't seem to be used much anywhere else these days, though. -- Greg
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web