[wxPython] Changing a menu item during execution.

Hi

Id like to change menu items during execution of my programme. heres my prob...

I get the menuitem from the menu with the menu id number something like...

menuitem=self.fileMenu.FindItemById(ID_FILE_CONNECT)

If I print this 'menuitem' I get

<C wxMenuItem instance at _8432a78_wxMenuItem_p>

If I try to use it like

menuitem.SetName("Dis&connect from Database")

I get

AttributeError: wxMenuItemPtr instance has no attribute 'SetName'

So FindItemById is returning a wxMenuItemPtr not a wxMenuItem. How do I de-reference this pointer. I didn't even realise there were pointers in python that needed dereferencing.

Thanks in advance for any help anyone can offer

Kind Regards

Crispin
crispin@iinet.net.au

Id like to change menu items during execution of my programme. heres my

prob...

I get the menuitem from the menu with the menu id number something like...

menuitem=self.fileMenu.FindItemById(ID_FILE_CONNECT)

If I print this 'menuitem' I get

<C wxMenuItem instance at _8432a78_wxMenuItem_p>

If I try to use it like

menuitem.SetName("Dis&connect from Database")

Try menuitem.SetText("Dis&connect from Database")

Or even easier:

    self.fileMenu.SetLable(ID_FILE_CONNECT, "Dis&connect from Database")

I get

AttributeError: wxMenuItemPtr instance has no attribute 'SetName'

So FindItemById is returning a wxMenuItemPtr not a wxMenuItem. How do I

de-reference this pointer. I didn't even realise there were pointers in
python that needed dereferencing.

It's just the way SWIG generates the code. There are two Python classes for
each C++ class. One is for when you create the object from Python, the
other is for when a C++ method returns a C++ pointer to an existing object.
Look in the wxPython/*.py files to see how they relate to each other.

ยทยทยท

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!