import itertools from copy import deepcopy from openexp.canvas import canvas from openexp.keyboard import keyboard from openexp.mouse import mouse from openexp.sampler import sampler input = 'touch' # We have two different experimental phases. In one phase, there are five options on the screen, and participants will touch one of them to respond; in the other phase, there are two options on the screen, and participants will touch one of them to respond. if input == 'keyboard': predict_keyboard = keyboard(exp, keylist=['left', 'right']) test_keyboard = keyboard(exp, keylist = ['1', '2', '3', '4', '5'])#, '6']) elif input == 'touch': touchscreen = mouse(self.experiment, buttonlist = None, visible = True) # This is pretty much how we get the software to record participants' response as they touch one of the options on the screen. elif input == 'touch': check = True touchscreen.set_pos(pos=(res_x/2, res_y/2)) touchscreen.buttonlist = None while check: button, pos, timestamp = touchscreen.get_click(visible = False) #print(button, pos) # pos contains an (x,y) tuple: x, y = pos elif input == 'touch': while True: flag = 0 touchscreen.set_pos(pos=(res_x/2, res_y/2)) button, pos, timestamp = touchscreen.get_click(visible = False) x, y = pos # Somehow, participants need to double tap the screen to get the software to record their response, and we can't figure out why.