samedi 5 mars 2016

How to make an if statement using button parameters as conditions?

Let's say i have a this button:

tl.config(bd=0 ,image=photo1 ,width="100",height="100",command=lambda: functionPlus(tl))  

The function is :

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

I would like to add an 'if' in the function, that would have as condition the image of the button. For exemple :

if button.config(image=photo2 == True) :
   anotherFunction()

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire