File: on_close.py

package info (click to toggle)
python-guizero 0.6.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,820 kB
  • sloc: python: 5,376; makefile: 28; sh: 17
file content (21 lines) | stat: -rw-r--r-- 363 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from guizero import *

"""
Functions
"""
# Ask user if they really want to close the window
def do_this_on_close():
    if alerts.yesno("Close", "Do you want to quit?"):
        app.destroy()

"""
Main
"""
app = App()

title = Text(app, "blank app")

# When user tries to close the window, execute do_this_on_close()
app.on_close(do_this_on_close)

app.display()