[wxPython-dev] Problem with MenuItem.Destroy()
Paul McNett
p at ulmcnett.com
Fri Jan 19 13:02:27 PST 2007
Okay, for now I've worked around the problem, using some code Robin
posted earlier in this thread, which works for 2.8 but not 2.6. So, for
2.6 I just keep Dabo's old behavior of discarding the RemoveItem()
return value:
def RemoveItem_28(self, item):
# Needed to keep dPemMixin mixed-in in wxPython 2.8
val = wx.Menu.RemoveItem(self, item)
item.this.own(val.this.own())
val.this.disown()
return item
def remove(self, index, release=True):
item = self.Children[index]
id_ = item.GetId()
if self._daboChildren.has_key(id_):
del self._daboChildren[id_]
if wx.VERSION[0] == 2 and wx.VERSION[1] >= 7:
item = self.RemoveItem_28(item)
else:
self.RemoveItem(item)
if release:
item.Destroy()
item = None
return item
Thanks again, Robin.
--
pkm ~ http://paulmcnett.com
More information about the wxpython-dev
mailing list