···
Robin Dunn wrote:
Andre Roberge wrote:
>[snip]
>>
>> "/Users/richb/Desktop/NewStuff
>> /src/rurple0.9.0.1/rur_py/world_display.py", line
>> 122, in MakePopupMenu
>> menu.Append(idx, str(self._beeperChoice[idx]))
>> File
>> "//Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/
>> wx-2.6-mac-ansi/wx/_core.py", line 10202, in Append
>> return _core_.Menu_Append(*args, **kwargs)
>> wx._core.PyAssertionError: C++ assertion "id != 0 || pSubMenu != NULL"
>> failed in
>> ../src/mac/carbon/menuitem.cpp(49): A MenuItem ID of Zero does not work
>> under Mac
>>=====
>> I can *guess* that doing a platform dependent choice (if mac: idx = 0,
>> else: idx = -1)
>If you use -1 then a new id will be generated and it will no longer be
>-1. You'll probably be better off to redesign your app so you don't
>need specific IDs.
Sorry, but I really do not understand this answer/suggestion. The "idx" is not
an id per se, but a choice along a list of pop-up items. Also, the
value of "-1" is never used.
The code deleted from your reply was the following:
=============
. def MakePopupMenu(self):
. """Make a menu for beepers that can be popped up later
. ...."""
. menu = wx.Menu()
. self. beeperChoice = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, \
. 11, 12, 13, 14, 15, 20, 40, 60, 80, 99]
. maxNumberOfBeepers = len(self. beeperChoice)
. idx = -1
. for x in self. beeperChoice:
. idx += 1
###### offending line 122 is the following:
. menu.Append(idx, str(self. beeperChoice[idx]))
. wx.EVT MENU RANGE(self, 0, maxNumberOfBeepers,
self.OnMenuSetBeepers)
. self.menu = menu
================
I start appending items at idx=0, and continue from thereon.
From what I understand of menu.Append(), it has to start appending
from zero - yet this leads to the exception on the mac using
wxPython [2.6.1.0](http://2.6.1.0) - but not with 2.5.3... (And it worked
perfectly well under Windows with 2.6..., 2.5..., 2.4...).
---
As for the other suggestions: thanks, I will definitely try!
>--
>Robin Dunn
>Software Craftsman
[
>http://wxPython.org](http://wxpython.org/) Java give you jitters? Relax with wxPython!
André