假设我有一个这个按钮:
tl.config(bd=0 ,image=photo1 ,width="100",height="100",command=lambda: functionPlus(tl))
Run Code Online (Sandbox Code Playgroud)
功能是:
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
Run Code Online (Sandbox Code Playgroud)
我想在函数中添加一个'if',它具有按钮图像的条件.举个例子 :
if button.config(image=photo2 == True) :
anotherFunction()
Run Code Online (Sandbox Code Playgroud)
提前致谢.