Untitled

 avatar
unknown
python
2 years ago
549 B
3
Indexable
import tkinter as tk

def change_color():
    current_color = label.cget("fg")
    new_color = "blue" if current_color == "red" else "red"
    label.config(fg=new_color)
    label.after(2000, change_color)

window = tk.Tk()
window.configure(bg="blue")

label = tk.Label(window, text="ahoj", font=("Arial", 24), fg="red", bg="blue")
label.pack(expand=True)

screen_width = window.winfo_screenwidth()
screen_height = window.winfo_screenheight()
window.geometry(f"{screen_width}x{screen_height}+0+0")

window.after(2000, change_color)
window.mainloop()
Editor is loading...