Hi everyone,
I’m new to Psychopy and I’m working on creating an online experiment where subjects will see lines of different lengths and then be asked to draw the line they just saw using a mouse. Specifically, I want them to be able to increase the length of the line by 4 pixels with each scroll up and decrease it by 4 pixels with each scroll down. I already have this code for a desktop version but it is not compatible with online studies. I know that I am not supposed to use Python libraries for online studies but how else I can adjust that ? :
my_mouse = Mouse()
my_canvas = Canvas()
my_mouse.show_cursor(True)
my_mouse.set_pos(pos=(0.0,0.0))
my_canvas.show()
while True:
var.init_pos = my_mouse.get_pos()
button, start_pos, timestamp = my_mouse.get_click(timeout=20, visible=True)
var.start_resp = timestamp
if button is not None:
var.sx, var.sy = start_pos
ex, ey = start_pos
while any(my_mouse.get_pressed()):
(var.ex, var.ey), timestamp = my_mouse.get_pos()
var.end_resp = timestamp
my_canvas.clear()
my_canvas.line(var.sx, var.sy, var.ex, var.ey)
my_canvas.show()
break)