[Interest] running Qt main event loop in secondary thread

Stefan Seefeld stefan at seefeld.name
Tue Mar 28 19:54:15 CEST 2023


Hi again,

It looks like the problem is that pyqt5 creates some hidden Qt objects very
early (i.e. upon importing some modules). If I move the imports as well as
the `MainWindow` definition into the secondary thread, everything appears
to be working fine.


On Tue, Mar 28, 2023 at 9:16 AM Stefan Seefeld <stefan at seefeld.name> wrote:

> Thanks all for the quick follow-up !
>
> It's good to hear that what I have in mind *should* work. However, I'm
> actually struggling a bit with the implementation. I have attached a very
> simple test-case creating a simple (pyqt5) app. If I call the `main()`
> function rather than `run_app()` directly, the script fails: First I see
> the error / warning message
>
>   `WARNING: QApplication was not created in the main() thread.`
>
> the main window appears, but isn't fully constructed and it doesn't look
> like the event loop is ever started. (The window's content isn't updated,
> no button appears, and the app isn't receiving input events.)
> What am I doing wrong ?
>
> Thanks,
>
>
>       ...ich hab' noch einen Koffer in Berlin...
>
>

-- 

      ...ich hab' noch einen Koffer in Berlin...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230328/ef88bafa/attachment.htm>


More information about the Interest mailing list