MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / the_thread

Function the_thread

DemoPrograms/Demo_Multithreaded_Write_Event_Value.py:18–30  ·  view source on GitHub ↗

The thread that communicates with the application through the window's events. Once a second wakes and sends a new event and associated value to the window

(window)

Source from the content-addressed store, hash-verified

16
17
18def the_thread(window):
19 """
20 The thread that communicates with the application through the window's events.
21
22 Once a second wakes and sends a new event and associated value to the window
23 """
24
25 window.write_event_value(('-THREAD-', '-STARTED-'), None) # Tell the GUI the thread started
26
27 for i in range(5):
28 time.sleep(1)
29 window.write_event_value(('-THREAD-', '-PRINT-'), i) # Data sent is a tuple of thread name and counter
30 # Note that the thread ended event is sent automatically by PySimpleGUI if you started the thread using window.start_thread
31
32def main():
33 """

Callers 1

mainFunction · 0.70

Calls 1

write_event_valueMethod · 0.80

Tested by

no test coverage detected