Slip 10 - A) Write Python GUI program to display an alert message when a button is pressed.

Solution:

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()

Output:

Output_pic


Post a Comment

0 Comments