Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ending the Program
#2
You can use a messagebox to promto for a Yes or No response if you are going to design this to run in a GUI.
Example:
import tkinter as tk
from tkinter import Label
from tkinter import Button
from tkinter import messagebox

root = tk.Tk()
root.geometry('300x300')

label=Label(root, text= 'Your gamre application is running')
label.pack()

def popup():
    your_popup = messagebox.askyesno('Your Game Name','Do you want to continue?')
    if your_popup == True:
        return
    else:
        root.destroy()
button=Button(root, text='Press', command=popup)
button.pack()

root.mainloop()
"Often stumped... But never defeated."
Reply


Messages In This Thread
Ending the Program - by Twoshawns - May-18-2020, 10:38 PM
RE: Ending the Program - by DT2000 - May-19-2020, 12:44 AM
RE: Ending the Program - by menator01 - May-19-2020, 02:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  While loop not ending (Best of 10 dice game) K3nidi 3 1,534 Jul-09-2022, 09:53 AM
Last Post: K3nidi
  Python: Call function with variabele? Ending in error. efclem 5 2,991 Apr-22-2020, 02:35 PM
Last Post: buran
  ending process hrparra 1 1,923 Jan-07-2020, 07:40 PM
Last Post: ibreeden
  Ending loop with string (capital & lowercase) MattWilk97 3 3,474 Oct-22-2017, 09:13 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020