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)
| 16 | |
| 17 | |
| 18 | def 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 | |
| 32 | def main(): |
| 33 | """ |
no test coverage detected