Thursday, July 17, 2025

Change the background color of a simple GUI using Tkinter in Python

import tkinter as tk


def change_bg():

    root.config(bg="lightblue")  # Change background color


root = tk.Tk()

root.geometry("200x100")

btn = tk.Button(root, text="Change Background", command=change_bg)

btn.pack(pady=20)

root.mainloop()

 

No comments:

Post a Comment

Complete Course Programs – Learn & Grow with Us

 We offer professional development courses for students, job seekers, and kids. Start your journey from basics to advanced with practical tr...