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

[email protected]
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
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

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.