
"The core idea is that your secondary window doesn't need direct access to the thread or the worker object. Instead the secondary window and the worker just need access to the same signals, and can then use them to communicate with one another."
"When you create a background thread from the main window, you'll often store a reference to that thread on the main window. If that main window then creates a sub-window, it doesn't have any access to the objects on its parent."
"Instead, use signals and slots. When a signal is emitted in one thread and connected to a slot in another, Qt automatically queues the call and delivers it safely."
In PyQt6 applications, secondary windows cannot directly access background threads started from the main window. Instead, they should communicate using Qt's signal and slot system. This method avoids tight coupling between components and ensures safe cross-thread communication. Direct access to threads can lead to issues, as sub-windows do not have references to parent objects. By emitting signals from secondary windows and connecting them to slots in the worker thread, the application maintains isolation and stability.
Read at Python GUIs
Unable to calculate read time
Collection
[
|
...
]