sirk390 / wxasync

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

wx._core.wxAssertionError with HtmlHelpDialog #29

Open topic2k opened 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 ```

Running src/example/more_dialogs.py, clicking on HtmlHelpDialog and closing the dialog results in an exception:

Exception in callback WxAsyncApp.OnTaskCompleted(<Task finishe...ws messages')>)
handle: <Handle WxAsyncApp.OnTaskCompleted(<Task finishe...ws messages')>)>
Traceback (most recent call last):
  File "C:\Python311\Lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Python311\Lib\site-packages\wxasync.py", line 89, in OnTaskCompleted
    _res = task.result()
           ^^^^^^^^^^^^^
  File "D:\EventGhost-2023\EventGhost-async.py", line 111, in on_HtmlHelpDialog
    await self.ShowDialog(dlg)
  File "D:\EventGhost-2023\EventGhost-async.py", line 80, in ShowDialog
    response = await AsyncShowDialogModal(dlg)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\wxasync.py", line 166, in AsyncShowDialogModal
    return await ShowModalInExecutor(dlg)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\wxasync.py", line 129, in ShowModalInExecutor
    return await loop.run_in_executor(None, dlg.ShowModal)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wx._core.wxAssertionError: C++ assertion "wxThread::IsMain()" failed at ..\..\src\msw\evtloop.cpp(176) in wxGUIEventLoop::Dispatch(): only the main thread can process Windows messages