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


Groups > comp.lang.python > #8946

Re: wx MenuItem - icon is missing

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <philip@semanchuk.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'assign': 0.04; 'elif': 0.04; 'ubuntu': 0.04; 'subject:missing': 0.07; 'wxpython': 0.07; ':-(': 0.09; 'calculator': 0.09; 'exception.': 0.09; 'c++': 0.12; 'am,': 0.13; 'wrote:': 0.15; '46,': 0.16; '9.04': 0.16; '__init__': 0.16; 'assertion': 0.16; 'bye': 0.16; 'helped.': 0.16; 'independent,': 0.16; 'received:mindspring.com': 0.16; 'skip:" 100': 0.16; 'skip:/ 50': 0.16; 'traceback.': 0.16; 'virtualbox': 0.16; 'wandering': 0.16; 'x-mailer:apple mail (2.1084)': 0.16; '>>>': 0.16; 'rewrite': 0.19; 'that?': 0.19; '(most': 0.21; "aren't": 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'code.': 0.22; 'trying': 0.23; 'item.': 0.23; 'platforms.': 0.23; 'though.': 0.23; 'welcome.': 0.23; 'systems.': 0.23; 'worked': 0.24; 'code': 0.24; 'traceback': 0.25; 'guess': 0.28; 'seem': 0.31; 'error': 0.31; 'generally': 0.33; "i'll": 0.33; 'list.': 0.33; "i've": 0.33; 'to:addr:python-list': 0.34; 'received:24': 0.34; 'there': 0.34; 'couple': 0.34; 'test': 0.34; "we're": 0.34; 'all.': 0.35; 'project': 0.35; 'icon': 0.35; 'last):': 0.35; 'thank': 0.35; 'probably': 0.35; 'supposed': 0.35; 'charset:us- ascii': 0.36; 'file': 0.36; 'some': 0.37; 'but': 0.37; 'subject:: ': 0.38; 'menu': 0.38; 'something': 0.38; 'think': 0.38; 'platform': 0.38; 'mailing': 0.38; 'should': 0.39; 'header:Mime- Version:1': 0.39; 'got': 0.39; 'under': 0.39; 'to:addr:python.org': 0.39; 'might': 0.39; 'called': 0.40; 'where': 0.40; 'kind': 0.60; 'your': 0.60; 'header:Message-Id:1': 0.61; 'results': 0.62; 'you.': 0.62; "we've": 0.62; 'apps': 0.63; 'our': 0.63; 'ever': 0.65; 'addressing': 0.67; 'click': 0.79; '10.6': 0.84; 'common,': 0.84; 'popup': 0.84; 'received:69.73': 0.84; 'territory': 0.84; 'seriously,': 0.91; 'something.': 0.91
Content-Type text/plain; charset=us-ascii
Mime-Version 1.0 (Apple Message framework v1084)
Subject Re: wx MenuItem - icon is missing
From Philip Semanchuk <philip@semanchuk.com>
In-Reply-To <4E13FFE1.1080303@shopzeus.com>
Date Wed, 6 Jul 2011 11:36:00 -0400
Content-Transfer-Encoding quoted-printable
References <4E12C505.3020300@shopzeus.com> <8B072395-5E0C-49C7-BBC4-38BAD25D0C05@semanchuk.com> <4E1366D5.6030208@shopzeus.com> <D610BFCB-C437-4FDF-83BC-42779715347F@semanchuk.com> <4E13FFE1.1080303@shopzeus.com>
To Lista-Comp-Lang-Python list <python-list@python.org>
X-Mailer Apple Mail (2.1084)
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - deimos.nocdirect.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - semanchuk.com
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.702.1309966578.1164.python-list@python.org> (permalink)
Lines 64
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1309966578 news.xs4all.nl 21783 [2001:888:2000:d::a6]:59160
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8946

Show key headers only | View raw


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


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


Thread

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

csiph-web