import tkinter as tk def button_click(): print("Button clicked!") root = tk.Tk() button = tk.Button(root, text="Click me!", command=button_click) button.pack() root.mainloop()
import tkinter as tk def change_background_color(): root.configure(bg='blue') root = tk.Tk() button = tk.Button(root, text="Change Background Color", command=change_background_color) button.pack() root.mainloop()Both of these examples use the Tkinter package library.