Q
Q
Quiab2020-07-21 15:09:07
Python
Quiab, 2020-07-21 15:09:07

How to create a separate thread that can change the main one?

Next problem: The program consists of an authorization window and a main window that displays a flag for connecting to a remote server. When the main window is initialized, a thread is created that pings the server, if it fails, changes the flag value and tries to reconnect for 30 seconds. If it doesn't work, it displays an error message and returns to the authorization window. It was intended that way, but it turns out that after displaying an error message and closing the main window, the program hangs. How should I design a separate thread in such a situation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-07-21
@Quiab

The GUI libraries are not thread safe. You can only work with interface components in a multithreaded environment using special library tools.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question