[wxPython] wxMenu FindItemForID Broken?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] wxMenu FindItemForID Broken?

Mark Jeacocke
Hi,
        I have an app written in a previous version of wxPython, last night I
downloaded 2.1.11 and noticed that it didn't seem to like the
FindItemForID function call anymore. (This was a previously working app
running on version 2.0b9).  The documentation doesn't say that the
function call is deprecated so I'm assuming it should still work.

I'm running on NT4 with wxPython version 2.1.11.  If I simply comment
out the code the app runs fine (minus that bit of functionality of
course!), as do the wxPython demo programs, so it's installed OK.

        mitems = []
               
        ...

        self.smenu = wxMenu()
        self.smenu.Append( 1, 'Menu Item 1' )

        ...

        mitems.append( self.smenu.FindItemForID( 1 ) )

 
Error given is:
-----------------------------------start
here----------------------------
Traceback (innermost last):
  File "<stdin>", line 1567, in ?
  File "<stdin>", line 1559, in main
  File "C:\PROGRA~1\Python\wxPython\wx.py", line 1564, in __init__
    _wxStart(self.OnInit)
  File "<stdin>", line 1551, in OnInit
  File "<stdin>", line 1093, in __init__
  File "<stdin>", line 1531, in LoadRecent
  File "<stdin>", line 1536, in DisplayRecent
AttributeError: FindItemForID
-----------------------------------end here----------------------------

        Hope this helps!

Cheers
Mark Jeacocke
[hidden email]

_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxMenu FindItemForID Broken?

Robin Dunn
> Hi,
> I have an app written in a previous version of wxPython, last night I
> downloaded 2.1.11 and noticed that it didn't seem to like the
> FindItemForID function call anymore. (This was a previously working app
> running on version 2.0b9).  The documentation doesn't say that the
> function call is deprecated so I'm assuming it should still work.
>

There was a bunch of low level changes to the menus before the last release,
a few of which percolated up to the interface like this one.  Unfortunatly
not all of them made it to the docs either.

Try FindItemById.  It taks an Id and returns a wxMenuItem.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users