Saturday, 22 January 2022

Pythoneslip10a-Write Python GUI program to display an alert message when a button is pressed.

 Write Python GUI program to display an alert message when a button is pressed.

import tkinter.messagebox

def onClick():

    tkinter.messagebox.showinfo("Title goes here","Message goes here")

root = tkinter.Tk()

root.geometry('500x300')

button = tkinter.Button(root,text = "Click Me", command = onClick)

button.pack(side='bottom')

root.mainloop()