我正在编写一个小程序,当点击一个按钮时,标签的颜色变为绿色(默认情况下它是红色),并在一段时间后恢复为红色。使用time.sleep()并不起作用。
The code that I have already tried is:
def change():
label1.configure( bg ='green')
#problem comes here ...
label1.configure ( bg ='red')
# label1 is defined here..........
change() #doesn't work......
以上如何运作?