psychopy.org | Reference | Downloads | Github

Set position of button stimulus

OS (e.g. Win10): macOS 10.5
PsychoPy version (e.g. 1.84.x): 3.1.5
Standard Standalone? (y/n) Yes
What are you trying to achieve?: Set up the position of a visual.ButtonStim after defining it.

What did you try to make it work?: I defined the Button without a position in the “Begin Routine” tab and tried to set the position manually afterwards to see which command I have to use to set up the position of the button Stim after defining it. Button.pos() does not seem to do the trick.

Button = visual.ButtonStim( win, labelText= "1" )

Button.pos = (0, 0)

What specifically went wrong when you tried that?:
The Button is no longer displayed. So setting the position of the button Stim apparently does not work like this and I am wondering how I can achieve it.

Hi There,

Have you tried something like?

Button.setPos([0, 0])

Sorry, I actually notice that because the “Button” is a list of items you need to set the position of all items.

Something like this should work:

for item in Button.buttonItems:
    item.setPos([-2,2])