import tkinter as tk
def first():
firstButton["bg"] = "#0000ff"
secondButton["bg"] = "#fff000"
def second():
firstButton["fg"] = "#fff000"
secondButton["fg"] = "#0000ff"
root = tk.Tk()
root.title("Україна")
firstButton = tk.Button(root, text="Моя країна", width=20, height=3,
font=("Arial", 25), command=first)
secondButton = tk.Button(root, text="Україна", width=20, height=3,
font=("Arial", 25), command=second)
firstButton.pack()
secondButton.pack()
root.mainloop()
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
import tkinter as tk
def first():
firstButton["bg"] = "#0000ff"
secondButton["bg"] = "#fff000"
def second():
firstButton["fg"] = "#fff000"
secondButton["fg"] = "#0000ff"
root = tk.Tk()
root.title("Україна")
firstButton = tk.Button(root, text="Моя країна", width=20, height=3,
font=("Arial", 25), command=first)
secondButton = tk.Button(root, text="Україна", width=20, height=3,
font=("Arial", 25), command=second)
firstButton.pack()
secondButton.pack()
root.mainloop()