File: on_close.py

package info (click to toggle)
python-guizero 1.1.1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,676 kB
  • sloc: python: 6,286; makefile: 28; sh: 17
file content (15 lines) | stat: -rw-r--r-- 344 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from guizero import App, Text

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

app = App()

title = Text(app, "blank app")

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

app.display()