Phoenix crashes if you don't make an event binding in handler init

Hi,
speaking of handlers, I just stumbled in a Phoenix crash (at least on windows):

class MyHandler(wx.EvtHandler):
def init(self):
wx.EvtHandler.init(self)
# self.Bind(WHATEVER, callback) this way does not crash

class MainFrame(wx.Frame):
def init(self, *a, **k):
wx.Frame.init(self, *a, **k)
self.button = wx.Button(self, -1, ‘clic’)
handler = MyHandler()
handler.Bind(wx.EVT_BUTTON, self.on_clic)
self.button.PushEventHandler(handler)
self.Bind(wx.EVT_CLOSE, self.on_close)

def on_clic(self, evt):
    print('hello')

def on_close(self, evt):
    # we have learned our lesson...
    self.button.PopEventHandler()
    evt.Skip()

``

In Classic (ie, 3.0.2.0), this works like a charm.

Apparently, you must do some event binding directly in your derived handler class’ init, or Phoenix just dies in flames (appropriately enough).
Windows reports a crash in wxbase30u_vc140_x64.dll

riccardo

Moved to: wx.EvtHandler must have event binding · Issue #443 · wxWidgets/Phoenix · GitHub

···

riccardo.polignieri@gmail.com wrote:

Hi,
speaking of handlers, I just stumbled in a Phoenix crash (at least on
windows):

--
Robin Dunn
Software Craftsman