Mouse function broken in 1.85.6 and 1.90 on Mac

Hi there,

I tried the standalone version (1.85.6) on Mac and the newly released version 1.90. It seems that the mouse functions are broken in both versions.

In 1.85.6 (the standalone version), I got the following error message when I called the .getPos method. I’m quite certain that .setPos is also broken.

X, Y = self.mouse.getPos()

File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/event.py”, line 499, in getPos
lastPosPix = lastPosPix - self.win.size / 2
TypeError: unsupported operand type(s) for /: ‘tuple’ and ‘int’

With the new release (ver. 1.90), I installed it from the command line with pip. The mouse position returned by .getPos was incorrect, I can only move the mouse in the lower-left quarter of the screen. I think this may have something to do with the retinal display of my Macbook Pro.

Bests,

Zhiguo

I have also encountered this. It seems to be some kind of weird outdated version of event.py that gets downloaded and installed with some versions and not others.

You can fix it for yourself quite easily. Click the blue text in the error message to go to the line in question and change it to this:

lastPosPix = lastPosPix - numpy.array(self.win.size) / 2

The 1.90.0 issue is indeed a problem with the translation from retina-ready coordinates. That is fixed by this change in the repository, which will be in the 1.90.1 release (pretty soon):

Hi Jonathan & Jon,

Thanks for the prompt reply! I managed to fix 1.85.6 and will stick to that version for a while.

Bests,

Zhiguo

@jon There’s a separate issue as well, which is that even some people downloading 1.85.3 or 1.85.6 for mac are getting an outdated version of event.py. Note the difference in the line quoted in the error message and the line that I made. I’ve had to fix that on multiple people’s computers now. Any idea how that came about? The fixed code was present for many updates prior to 1.9.

There was a human error in the release of 1.85.3 on Mac (I accidentally packaged the wrong branch of the repository!). I forget whether the fix for win.size was included in 1.85.6.

Another thing that has occasionally caused errors in packaging is that a couple of times we’ve released dual copies of code by mistake when a pyc python file of one version as well as a folder containing files from another version (it’s hard to explain) and then the results of what gets imported are unpredictable. I think I’ve squashed that issue in the packaging mechanism now though so I don’t think we’ve seen it recently.

Hi everyone! I seem to have a similar problem, though I run the latest release - StandalonePsychoPy3-3.0.3-MacOS . I am trying to use a slider in Builder, but when I click on the scale, the marker appears at the wrong place. The weirdest thing is that when I used the program for the first time I had no problem like that, everything worked. I was experimenting with the design and at some point, this problem appeared. Since then I can’t solve it. I would appreciate any advice. I am new to PsychoPy, so I apologize if the solution is actually trivial or I missed some recent posts on it.
(FYI - I use MacBookPro with Retina display)

Thank you in advance!

The original issue in this post has been solved in PsychoPy 3.0+ (or earlier, I forget)

Natalie, your new issue sound like a layout problem. Could you open a separate post, preferably with a screenshot of the incorrect location and ideally a minimal version of the experiment so I can try and recreate the issue myself.

Thanks, Jon

1 Like

Thank you for the reply! I created the new topic here Cursor location is wrong on Retina display
Please, let me know if I should add more information about the problem or something is unclear.
Thank you,
Natalia