【发布时间】:2016-06-19 05:55:26
【问题描述】:
假设我有一个这个按钮:
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”,它以按钮的图像为条件。例如:
if button.config(image=photo2 == True) :
anotherFunction()
提前致谢。
【问题讨论】:
标签: python if-statement tkinter conditional-statements