[wxPython] replacing menus

Hi,

I'm hoping to get some pointers on how to change the menus in a menu
bar. I'm using wxPython and wxGTK. I have several menus defined and
I want to switch them as the user interacts with the program. I have
tried the menubar's replace function as well as a remove&append.

Either way, the menu works the first time. The second time I choose
it, after it has been replaced, my app segfaults and crumbles like a
house of cards. Can anyone help? I can see that something not quite
right is happening but I don't know what else to do.

Sample code:
menubar.Append(panel.menu, '&' + title)
or
lastmenu = menubar.GetMenuCount() - 1
menubar.Replace(lastmenu, panel.menu, '&' + title )

Errors:

Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to
GtkMenuItem

Gtk-CRITICAL **: file gtkwidget.c: line 3539: assertion `style !=
NULL' failed.
Segmentation fault

Thanks,
Mike

I'm hoping to get some pointers on how to change the menus in a menu
bar. I'm using wxPython and wxGTK. I have several menus defined and
I want to switch them as the user interacts with the program. I have
tried the menubar's replace function as well as a remove&append.

Either way, the menu works the first time. The second time I choose
it, after it has been replaced, my app segfaults and crumbles like a
house of cards. Can anyone help? I can see that something not quite
right is happening but I don't know what else to do.

Looking at the code it seems like it should work. Can you reduce it to a
small sample that duplicates the problem and send the source?

ยทยทยท

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