所以我有一些代码可以在点击时改变按钮的图像。现在,如果我只想让按钮在被点击时改变,然后恢复正常呢?(就像普通按钮一样)我不能只添加另一个.config方法,因为它会跳过第一个方法,并保持按钮的图像不变。我也不能等待,因为它只是冻结程序并产生相同的结果。在
PlayUp = PhotoImage(file=currentdir+'\Up_image.gif')
PlayDown = PhotoImage(file=currentdir+'\Down_image.gif')
#Functions
def playButton():
pButton.config(image=PlayDown)
return
#Play Button
pButton = Button(root, text="Play", command=playButton)
pButton.grid(row=1)
pButton.config(image=PlayUp)
最好的方法,使按钮图像改变为看起来像一个真正的按钮按下,但图像是这样做的。在
定义您的照片:
定义您的功能:
^{pr2}$初始化按钮:
相关问题 更多 >
编程相关推荐