I am using Psychopy 3 on Windows 10 and I am trying to create a rectangle that - when clicked on - allows users to continue to the next screen. I managed to make this work on a left button press (see example below, where the screen just closes after a button press). However, when creating multiple screens with identical ‘continue buttons’, I discovered that the programme skips through all screens if you hold the mouse button for too long.
The ideal solution would be to only close/flip the current screen after a ‘mouse button up’ press (comparable functionalities exist in Neurobs Presentation). I saw that the CustomMouse has this option, but unfortunately this functionality is too limited for the rest of my script. Does anybody know another workaround…?
Note: a simple wait() statement could do part of the job of course, but I am looking for a more ‘neat’ option.
#import modules from psychopy.visual import Window, Rect from psychopy.event import Mouse #initialise screen and mouse display = (1366,768) win = Window(size=display, color='white', fullscr=False, units = 'pix') mouse = Mouse(visible=True) #create box object box = Rect(win,width=420,height=50, lineWidth = 3,lineColor='black', pos=(0,0), fillColor = (0.9,0.7,0.7)) #show box object until mouse click while True: box.draw() if mouse.isPressedIn(box, buttons=): # left button press win.close() win.flip()