mirror of
https://github.com/allankoechke/pywebview.git
synced 2026-12-01 09:24:15 +00:00
23 lines
515 B
Markdown
23 lines
515 B
Markdown
## Destroy window
|
|
|
|
Programmatically destroy created window after five seconds.
|
|
|
|
``` python
|
|
import webview
|
|
import threading
|
|
import time
|
|
|
|
|
|
def destroy(window):
|
|
# show the window for a few seconds before destroying it:
|
|
time.sleep(5)
|
|
print('Destroying window..')
|
|
window.destroy()
|
|
print('Destroyed!')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
window = webview.create_window('Destroy Window Example', 'https://pywebview.flowrl.com/hello')
|
|
webview.start(destroy, window)
|
|
print('Window is destroyed')
|
|
``` |