diff --git a/examples/window_title_change.py b/examples/window_title_change.py index 2222a1da..cd2182c3 100644 --- a/examples/window_title_change.py +++ b/examples/window_title_change.py @@ -1,14 +1,15 @@ """Change window title every three seconds.""" -import time - import webview def change_title(window): """changes title every 3 seconds""" for i in range(1, 100): - time.sleep(3) + # exit loop when window is closed + if window.events.closed.wait(3): + break + window.title = f'New Title #{i}' print(window.title)