Checkbox in popup menu

Does anyone know how to make checkboxes work inside popup menus ?

The default behaviour is to close the popup when the checkbox is
clicked. I would really like to be able to make a number of selections
of checkbox items and then invoke functions in the popup menu.

I don't seem to be able to catch the relevant event and prevent it
being passed on to whatever is closing the menu.

The closest thing to a solution I have seen is this:

http://groups.google.com/group/wxPython-users/msg/9793d6cf3c47d1f6

However, this isn't quite enough to get it to work..

john porter wrote:

Does anyone know how to make checkboxes work inside popup menus ?

The default behaviour is to close the popup when the checkbox is
clicked. I would really like to be able to make a number of selections
of checkbox items and then invoke functions in the popup menu.

I don't seem to be able to catch the relevant event and prevent it
being passed on to whatever is closing the menu.

There isn't one. Calling PopupMenu is like a dialog's ShowModal. It doesn't return until a menu item has been selected, and then since it is a menu the menu is then dismissed. That's just the way that menus work and you can't change that. It sounds like what you want is not a menu but a dialog or some other popup window that you can place wx.CheckBoxes on.

···

--
Robin Dunn
Software Craftsman