Change background color GUI program in python tkinter

Change background color GUI program in python Tkinter. This program will create a new pop up window and ask the user to select the color as a background in the output window. Changing color in word or notepad is not that difficult but it matters when it comes to programming especially GUI programming in Tkinter python.

import tkinter as tk
from tkinter.colorchooser import *
def getColor():
color = askcolor()
print(color[1])
mw.configure(background=color[1])
mw = tk.Tk()
mw.title(‘COLOR ME!!!’)
mw.geometry(“400×400”)
mw.resizable(0, 0)
tk.Button(text=’Choose your favourite color’, command=getColor).pack()
mw.mainloop()

We can create new applications such as a music player, pdf reader, and other things using these basic Tkinter python gui programmes. The background colour of the Python application is being changed in this example. We may also alter or fix the application’s window size, such as the screen resolution, which is 400*400 in this case.