在python中闪烁文本颜色2秒

时间:2017-09-05 03:38:52

标签: python text colors label flashing

新编码并尝试制作一个得分板程序,当目标得分时,我希望文本颜色改变,然后在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)

0 个答案:

没有答案