r0x0r / pywebview

Build GUI for your Python program with JavaScript, HTML, and CSS
https://pywebview.flowrl.com
BSD 3-Clause "New" or "Revised" License
4.77k stars 555 forks source link

Fix window change title example exit #1515

Closed dlech closed 1 week ago

dlech commented 3 weeks ago

Since the thread running the timer loop in examples/window_title_change.py is not a daemon thread, the program will not exit when the main thread ends due to the window closing.

Instead of using an uninterruptible sleep, we can use the window closed event as the timer with the added bonus that we can exit the timer loop when the window is closed so that the program can exit.