[wxPython-dev] Problem with MenuItem.Destroy()
Robin Dunn
robin at alldunn.com
Sat Jan 20 16:29:43 PST 2007
Paul McNett wrote:
> Okay, sorry to keep coming back after weeks in between :) but while your
> above sample works fine for raw wx.MenuItem instances, it doesn't work
> for Dabo which mixes-in a dabo.ui.dPemMixin and a wx.MenuItem to create
> a dMenuItem. This code in my working copy of dMenu.remove():
>
> print "Before RemoveItem:", item.__class__.__bases__
> item = self.RemoveItem(item)
> print "After RemoveItem:", item.__class__.__bases__
>
> shows that the return value from RemoveItem() has lost the Dabo part of
> __bases__:
>
> Before RemoveItem: (<class 'dabo.ui.uiwx.dPemMixin.dPemMixin'>, <class
> 'wx._core.MenuItem'>)
> After RemoveItem: (<class 'wx._core.Object'>,)
Just for the record this is because wx.MenuItem does not keep track of
the original Python proxy objects, and so SWIG makes a new proxy for the
return value.
> if wx.VERSION[0] == 2 and wx.VERSION[1] >= 7:
> item = self.RemoveItem_28(item)
You can simplify that comparrison a little bit by using
if wx.VERSION >= (2,7):
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-dev
mailing list