Can't update opacity for circle stim

Hi -

I have been trying to update the opacity of the circle stimulus.
Here is how I have updated the opacity:

a. circle.setOpacity = 0
b. circle.opacity = 0

Neither one works.

Here is how i defined the circles:
circle = visual.Circle(myWin, radius=150, pos=(0, 0), units="pix", fillColor="grey", lineColor="grey", interpolate=True, autoDraw=True)

Any ideas how to make the circles transparent? I have also tried .setAutoDraw(False) and redefining the circle stimulus with fillColor = None. But neither works.

Thanks!

setOpacity is a function, not a property.

circle.setOpacity(0)

That should work.

Hi Jonathan,

Thanks for your reply. I tried your way but it does not work…Any idea why? Is it because setOpacity does not appear directly after defining circle? Here is my code -

    coin.opacity = 0 #img stimulus
    bucket.setOpacity(0) #shape stimulus
    bag.opacity = 0 #img stimulus
    circle_big.setOpacity(0) #circle stimulus
    circle_small.setOpacity(0) #circle stimulus
    play_button.setAutoDraw(False) #button

Many thanks in advance!

Best,

Sophie

You could try setOpacity(0.0) (so, giving it a float rather than an integer) but I would be a little surprised if that worked.

If not that, I think I would need to see the full display loop or more of the experiment to figure out what’s going on. It might be an issue with drawing the circle again after changing the opacity or something else setting the opacity back to 1.0 later, because that’s definitely how you change the opacity of a shape.