Friday, 10 April 2020

Python Program-11

(11) Develop programs to learn GUI programming using Tkinter.


Program Code:

try: import tkinter
except: import Tkinter as tkinkter 
root = tkinter.Tk()
def grey(*args, **kwargs): 
root.configure(background="grey")
def bthing(): 
root.configure(background="red")
def bthing1(): 
root.configure(background="green")
def bthing2(): 
root.configure(background="blue") 
root.after(1000,grey)
tkinter.Button(text="RED", command=bthing).pack() 
tkinter.Button(text="Green", command=bthing1).pack() 
tkinter.Button(text="BLUE", command=bthing2).pack() 
root.configure(backround="grey") 
root.geometry("100*100")

root.mainloop()

Output:

No comments:

Post a Comment