Thursday, 20 January 2022

Python Slip4-A-Write Python GUI program to create background with changing colors

Write Python GUI program to create background with changing colors

#Import the tkinter library

from tkinter import *

#Create an instance of tkinter frame

win = Tk()

 

#Set the geometry

win.geometry("600x400")

 

 #Define a function to change the text color

def change_color():

   win.configure(background="red")

Button(win, text= "Red Color", command= change_color).pack(pady=10)

  

def change_color1():

   win.configure(background="blue")

 

#Create a Button widget

Button(win, text= "Blue Color", command= change_color1).pack(pady=10)

 win.mainloop()