Help needed with running the backend of the application #3234
Replies: 1 comment 3 replies
|
A fix for this is going to be very specific to your app's circumstances, but I can try and fill in some of the background here. The main loop handling is platform-specific. Based on the error you're reporting, I'm guessing you're on Windows - and on Windows, the app's main thread isn't the GUI loop. There's nothing that can be done to avoid that; it's a feature of how Winforms works. However, you can differentiate between instantiating the app, and starting the main loop. The code to start a Toga app is very explicitly: After the first line has executed, the app exists, but isn't running. The second lines starts the GUI main loop, which creates the second (GUI) thread. Any user actions that occur after that point in response to GUI events are occurring on the GUI thread. So - if you need to do something with signals... do it before you start the main loop. You can still have access to the app (and thus to app.paths and similar properties) - but you can't assume you can display a GUI or anything like that. |
Uh oh!
There was an error while loading. Please reload this page.
I want to use a module that uses the
signalmodule internally;I need to have access to
app.pathsbefore instanciating it, in order to have the proper paths to write data to;But I cant instanciate it on the app's startup because the app's main loop apparently is not on the main thread of the main interpreter...
I have no clue in how to handle this dilemma
All reactions