I have some code that ran fine on my previous Windows laptop, but some elements don’t work on my current macBook. Specifically, I cannot use my mouse to click on a rating scale when displayed, although this worked previously. Strangely, if I change the visual.Window() parameters so that the window displays on my second (ThinkVision) screen (by putting screen = 1, instead of 0 or blank), the mouse click works fine.
Below is the code that I use for the rating scale. I run 3 practice trials, for which a rating scale will be presented for each trial. There is no max limit, so the experiment will wait until a response is received (pressing ‘Enter’ will accept the rating), and then it will move to the next scale. On my macBook, changing “screen = 0” to “screen = 1” in the ‘win_global’ parameters is the only way I can get the rating scale to accept my mouse clicks. Pressing the ‘Esc’ key will quit the experiment, no matter what screen is used. The only error message I receive is the following, however this appears even when the rating scale works on the second screen, so I don’t think it’s related:
“Existing state will not be touched. New state will be written to /var/folders/sz/3br4b8q55xs1qdvw4gp9_q2r0000gn/T/org.opensciencetools.psychopy.savedState”
I’m using a MacBook Air (M1) macOS version 12.3.1, and PsychoPy version 2022.1.3. Any help would be greatly appreciated.
from psychopy import visual, event, gui, data, core from psychopy.hardware import keyboard import pickle endExpNow = False # flag for 'escape' or other condition => quit the experiment # create a default keyboard (e.g. to check for escape) defaultKeyboard = keyboard.Keyboard() # Set window dimensions win_global = visual.Window( fullscr = False, size = [1200, 800], winType = 'pyglet', allowGUI=True, allowStencil=True, monitor='testMonitor', color=[1,1,1], colorSpace='rgb', units='height', screen = 0) # changing to screen = 1 moves window to second screen # # PRACTICE TRIALS ------------------------------------------------------- for i in range(3): practice_rating_scale = visual.RatingScale( win_global, scale = None, # removes optional reminder on how to respond to rating low=-5, high=5, labels = ['very unpleasant', 'very pleasant'], marker = 'slider', stretch = 2, # stretches scale horizontally pos = (0, -0.3), lineColor='Black', markerColor='Black', textColor='Black') while practice_rating_scale.noResponse: practice_rating_scale.draw() win_global.flip() # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() keys = event.waitKeys(keyList = ['return'])```