sirk390 / wxasync

asyncio support for wxpython
MIT License
76 stars 9 forks source link

App.OnExit() isn't called #30

Closed topic2k closed 1 year ago

topic2k commented 1 year ago
Versions ``` Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32 wxasync 0.49 wxPython 4.2.2a1.dev5600+b67eef25 msw (phoenix) wxWidgets 3.2.2.1 ```

As the title says, OnExit() isn't called when exiting the app. Without wxasync, OnExit() is called.

wxasync demo code ```python import wxasync import wx import asyncio class MyApp(wxasync.WxAsyncApp): def OnExit(self): print("OnExit called") return 0 async def main(): app = MyApp() frame = wx.Frame(None) frame.Show() await app.MainLoop() asyncio.run(main()) ```
wxPython demo code ```python import wx class MyApp(wx.App): def OnExit(self): print("OnExit called") return 0 app = MyApp() frame = wx.Frame(None) frame.Show() app.MainLoop() ```
sirk390 commented 1 year ago

Hi @topic2k, thanks for the issue. What do you think about the fix like this https://github.com/sirk390/wxasync/commit/3ecfe3615af7871ce75a1154e1b84c87c6380680 ? Any other event missing?

topic2k commented 1 year ago

Yes, that's working. Thank you.