I'm trying to make a program that
(1) displays a window with a button in it
(2) when you press the button, the background of the window changes from one color to another...
(3) ...and then changes back to its original color after a short delay (without pressing the button again).
So far, I've managed (1) and (2), but I can't figure out how to implement (3). Here is my code:
Code:
from Tkinter import *
root = Tk()
def bthing(): root.configure(background="red")
b = Button(text="OK", command=bthing)
b.pack()
root.configure(background="grey")
root.geometry("400x400")
root.mainloop()
I can cause a delay before the background color changes by changing "def bthing(): root.configure(background="red")" to "def bthing(): root.after(1000, root.configure(background="red"))"
But what I want is something like... "root.configure(background="red") THEN root.after(1000, root.configure(background="grey"))"
Can someone point me in the right direction? I have no experience in programming.