Creating a User Prompt in a Tkinter GUI – Python GUI using Tkinter

  tkinter

Email

Creating a User Prompt in a Tkinter GUI – Python GUI using Tkinter

following code using an application to the development of the GUI

from tkinter import  *
import tkinter.messagebox

def custom_quit():
    answer = tkinter.messagebox.askokcancel("Are You sure?","data will be losse form the coding ")

    if(answer):
        print("exit"
              )
        quit()


def work():
    print("this working ")
    root.geometry("600x600")

def run():
    print("this is run coding")
    root.geometry("200x200")


root = Tk()
root.geometry("600x600")

menu1 = Menu(root)
root.config(menu=menu1)
submenu = Menu(menu1)
menu1.add_cascade(label="File",menu=submenu)
submenu.add_command(label="New Project", command=work)
submenu.add_command(label="Save As", command=run)
submenu.add_command(label="Save")
submenu.add_command(label="Setting")
submenu.add_command(label="Exit",command=custom_quit)

submenu1 = Menu(menu1)
menu1.add_cascade(label="Exit", menu=submenu)
submenu1.add_cascade(label="New Edit")

#--------------- staus bar ----------#

status = Label(root, text="Runing.......", relief=SUNKEN, anchor=W, bd=1)
status.pack(side=BOTTOM , fill=X)


root.mainloop()

 

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of