MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / the_thread

Function the_thread

DemoPrograms/Demo_Multithreaded_DataPump.py:93–104  ·  view source on GitHub ↗

The thread that communicates with the application through the window's events. Waits for data from a queue and sends that data on to the event loop :param window: :param thread_queue: :return:

(window:sg.Window, thread_queue:queue.Queue)

Source from the content-addressed store, hash-verified

91
92
93def the_thread(window:sg.Window, thread_queue:queue.Queue):
94 """
95 The thread that communicates with the application through the window's events.
96 Waits for data from a queue and sends that data on to the event loop
97 :param window:
98 :param thread_queue:
99 :return:
100 """
101
102 while True:
103 data = thread_queue.get()
104 window.write_event_value((THREAD_KEY, THREAD_INCOMING_DATA), data) # Data sent is a tuple of thread name and counter
105
106
107def main():

Callers 1

mainFunction · 0.70

Calls 2

write_event_valueMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected