比方说,我有一个按钮:如何使用小部件选项值作为条件来制作if语句?
tl.config(bd=0 ,image=photo1 ,width="100",height="100",command=lambda: functionPlus(tl))
功能是:
def functionPlus(button):
global turn
if (turn==1 or turn==3 or turn==5 or turn==7 or turn==9):
button.config(image=photo2,width="100",height="100")
turn +=1
elif (turn==2 or turn==4 or turn==6 or turn==8) :
button.config(image=photo3,width="100",height="100")
turn+=1
我想补充一个“如果”的功能,这将有作为条件的图像按钮。例如:
if button.config(image=photo2 == True) :
anotherFunction()
在此先感谢。
好吧!感谢您的解决方案和您的建议,代码现在正在工作。 –