Some issues occur because button.fillColor is a numpy array.
I found the following solution:
# Begin Routine:
mouseup = True # Prevents multiple clicks (see 1)
# Each frame:
if mouseup: # Checking whether the mouse is up or down
if mouse.isPressedIn(button):
mouseup = False
if list(button.fillColor) == [1, -1, -1]: # RGB Value of red
button.fillColor = 'blue'
else:
button.fillColor = 'red'
else:
if not 1 in mouse.getPressed():
mouseup = True
[1]
Experiment example:
changeButtonColor.psyexp (12.2 KB)