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

Function the_thread

DemoPrograms/Demo_Multithreaded_ProgressBar.py:37–48  ·  view source on GitHub ↗

The thread that communicates with the application through the window's events. Simulates downloading a random number of chinks from 50 to 100-

(window:sg.Window)

Source from the content-addressed store, hash-verified

35DL_THREAD_EXITNG = '-THREAD EXITING-'
36
37def the_thread(window:sg.Window):
38 """
39 The thread that communicates with the application through the window's events.
40
41 Simulates downloading a random number of chinks from 50 to 100-
42 """
43 max_value = random.randint(50, 100)
44 window.write_event_value((THREAD_KEY, DL_START_KEY), max_value) # Data sent is a tuple of thread name and counter
45 for i in range(max_value):
46 time.sleep(.1)
47 window.write_event_value((THREAD_KEY, DL_COUNT_KEY), i) # Data sent is a tuple of thread name and counter
48 window.write_event_value((THREAD_KEY, DL_END_KEY), max_value) # Data sent is a tuple of thread name and counter
49
50
51def main():

Callers 1

mainFunction · 0.70

Calls 1

write_event_valueMethod · 0.80

Tested by

no test coverage detected