>From a basic frame of mine, I derived other frames for several applications. Some events (wx.EVT_MENU and wx.EVT_BUTTON) that in the original frame are bound to a method, are no longer so in only one of the derived frames. The others work fine.
Where can I look for my mistake? In other words, what is liable to interrupt a connection created with the method Bind?
Does your derived frame also bind events? Do any of them have the same ID? Although we sugar-coat it a bit so the ID seems less important in wxPython code, that is what is used under the covers in wxWidgets to make the connection between an item, event type and handler. So if you are using matching IDs anywhere then not all the handlers will be called unless the prior ones are using event.Skip()
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
My bug was searched, found and destroyed, and I gather the solution of this tiny drama may be of some interest for the forum.
I use to keep trace of the last position of my frames, to recover it at the next opening.
Since this frame can be closed by the wx.CLOSE_BOX , a button and a menu, I thought it would have been particularly bright to bind the three events (EVT_CLOSE, EVT_MENU and EVT_MENU) to the same method. Well, it wasn’t: none of those events ever arrived to the method.
The working solution I found is to bind each event to a different function, which in turn will call the one function that actually stores the frame’s position.
If something more elegant can be suggested, I’ll oblige.
From a basic frame of mine, I derived other frames for several
applications. Some events (wx.EVT_MENU and wx.EVT_BUTTON) that in the
original frame are bound to a method, are no longer so in only one of
the derived frames. The others work fine.
Where can I look for my mistake? In other words, what is liable to
interrupt a connection created with the method Bind?
Does your derived frame also bind events? Do any of them have the same
ID? Although we sugar-coat it a bit so the ID seems less important in
wxPython code, that is what is used under the covers in wxWidgets to
make the connection between an item, event type and handler. So if you
are using matching IDs anywhere then not all the handlers will be called
unless the prior ones are using event.Skip()
–
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!