Hi,
I’m trying to create a psychopy.Window with the origin at the bottom of the screen instead of the center–this would make it much easier to implement an experiment I’m building. When I try using the viewPos attribute like this (In IPython 5.3.0 interpreter):
win = visual.Window(size=[500, 500], winType='pyglet',
viewPos=[0,-1], units='norm')
I get this error:
ValueError: operands could not be broadcast together with shapes (4,) (2,)
IPython’s traceback locates the error in psychopy/tools/monitorunittools.pyc. I get the same result if viewPos is set to anything (including [0,0]) except None
. I’ve also tried creating a window in a .py script.
I’ve tried searching around and I can’t find anyone else with the same issue. Could you help me with this?
I’m using Psychopy version 1.90.2 in a conda environment with Python 2.7.13 and pyglet 1.2.4.
Thanks for your time!
What if you try to define your viewPos in pixels rather than normalized unit (just to be consistent since size is in pix)? Change units=‘pix’ too.
1 Like
Thanks, @angjw.aaron, that worked! Is there a way to do this while keeping the units in ‘norm’? My situation is I have an entire experiment built, expecting stimuli positions in the [-1,1] range. It’d be a lot easier to add 1 to each instead of converting each to pixels!
I managed to find another work-around in the meantime, so no worries if that’s not possible!
I am afraid that is out of my expertise! I am curious as to why normalized units don’t work properly as well. Perhaps someone else might have an answer to this?
1 Like
This is all new to me, as I didn’t even know that the origin could be shifted, but have you tried setting the units to norm
after the window has been created?
1 Like
Just tried it, and unfortunately it didn’t work.
Switching units to norm moved the origin back to the center.
from psychopy import visual
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
win = visual.Window(size=[500,500], viewPos=[0,-250], units='pix')
win.units = 'norm'
test = visual.TextStim(win, text='hope this works!', pos=[0,1])
test.draw(); win.flip()
Out[6]: 85.47405004501343 # text at top of screen