Answers for "tkinter yes no messagebox"

0

python message box yes no script

import tkinter as tk
from tkinter import messagebox

root= tk.Tk()

canvas1 = tk.Canvas(root, width = 300, height = 300)
canvas1.pack()

def ExitApplication():
    MsgBox = tk.messagebox.askquestion ('Exit Application','Are you sure you want to exit the application',icon = 'warning')
    if MsgBox == 'yes':
       root.destroy()
    else:
        tk.messagebox.showinfo('Return','You will now return to the application screen')
        
button1 = tk.Button (root, text='Exit Application',command=ExitApplication,bg='brown',fg='white')
canvas1.create_window(150, 150, window=button1)
  
root.mainloop()
Posted by: Guest on October-02-2020
0

button onclick message box in python tkinter

import tkinter.messagebox
def onClick():
    tkinter.messagebox.showinfo("Title goes here","Message goes here")
root = tkinter.Tk()
button = tkinter.Button(root,text = "Click Me", command = onClick)
button.pack()
root.mainloop()
Posted by: Guest on November-05-2020

Python Answers by Framework

Browse Popular Code Answers by Language