新的编码和尝试为进球时制作记分板程序我希望文本颜色发生变化,然后在 2 秒后恢复为原始颜色。我添加了一个 2 秒睡眠功能,但它似乎延迟了整个过程而不是颜色变化。
# def actions that will take place when away team scores
def a_goal():
global awayscore
awayscore += 1
Label(main, text=awayscore, font='TkFixedFont 50 bold', fg='red', background= 'black').place(x=100, y=100)
time.sleep(2)
Label(main, text=awayscore, font='TkFixedFont 50 bold', fg='orange', background= 'black').place(x=100, y=100)