0

Reading this thread I have found out that:

"PyQt GUI calls like setText() on a QLineEdit are not allowed from a thread. Anything that has PyQt painting outside of the main thread will not work."

setText() here is only one example, however, I believe there are more, I am just not sure how many and what. Could anyone provide me with a list of all the GUI calls that would require to not be ran from a thread, or explain me, how I could possibly find that myself? Thank you.

Jokubas11
  • 79
  • 7
  • That "like" is not an example of some, but just one for *any*. UI elements are ***not*** thread safe, so: 1. reading their properties is fundamentally discouraged as not always reliable; 2. writing any property is not safe (if you're lucky, it "might" work, but it generally results in painting artifacts, inconsistent and unreliable behavior, and often causes crasheses). So, as a rule of thumb, ***all*** functions that might relate to the UI should **not** be used from an external thread. – musicamante Oct 13 '21 at 10:42
  • Asking this kind of question means you are *doing it wrong*. Qt does not support gui operations of any kind outside the main thread. The way to *do it right* is to move long-running *non-gui* calculations to a worker thread and then use signals to periodically update the gui (e.g. [like this](https://stackoverflow.com/a/38815580/984421)). – ekhumoro Oct 13 '21 at 13:37

0 Answers0