Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Using multiple keyboards


I'm building a group task (random dot motion) where I want to collect 3 individual responses per trial. Searching through the forum, I understood that using Chronos response boxes isn't an option when working with OpenSesame (at least not one easy one). Therefore, next best thing I could think of, is using 3 different keyboards with different key mapping for each participant to tackle this.

To be a bit more practical -

1) Each participant would have 2 response keys (6 keys in total).

2) Each participant could only make one, unchangable, decision each trial (first correct/incorrect response will be collected for each participant.

3) Trial should last untill 3 responses collected (+1 second delay) or 10 seconds have passed, whichever met first.

Should I expect any problems using 3 keyboards (e.g. fetching few responses at the same~ time)?

Also, say this is possible, if anyone has any ideas towards dealing with the programming side I'd be happy to consult with you (I've attached the working single participant experiment. It's just a matter of converting this to a group experiment).

Thank you,



  • O.K. so I pretty much got it doing what I wanted (1 and 2 for now). I tested it using 1 keyboard for now and it seems to be working.

    Still, if anyone know whether I should expect any technical issues using 3 different keyboards I'll be glad to hear.



  • Hi Omer,

    I wouldn't expect any problems with 3 keyboards, but still it would make sense to extensively test the procedure.

    Implementing point 3 shouldn't be very hard. Put an inline_script with the line: `var.start_time = clock.time()`before the keyboard_response item and then in the duration field of each keyboard response item `11000-[start_time]` and maybe another inline_script after the last keyboard_response item, in which you sleep for another second (using the clock.sleep function)

    I hope this helps,


  • ...
    var.allkeys = ['q', 'p', 's', 'l', 'z', 'm']
    timer = core.CountdownTimer(10.0)
    while var.allkeys != [] and timer.getTime() > 0: 	
    	for i in range(500):
    		ds.draw() # prepares the stimulus
    		win.flip() # makes stimulus visible on window
    		var.keys = event.getKeys(keyList=var.allkeys) # begins with all mapped keys eligible
    		if var.keys != []:
    			# participant 1
    			if any(c in var.keys for c in ('q', 'p')): # if this part. responded then -
    				t1 = self.time() # take time
    				response1 = var.keys[0] # save response
    				response_time1 = t1 - t0 # caculates response time
    				exp.set('response1', response1) # log response
    				exp.set('response_time1', response_time1) # log RT
    				if self.get('response1')==self.get('correct_response1'):
    					exp.set('correct1',1) # log accuracy
    				var.allkeys = [item for item in var.allkeys if item not in ['q', 'p']]
    				if var.allkeys == []: # if this part. was last to respond - finish trial
    			# participant 2	
    			elif any(c in var.keys for c in ('s', 'l')):
    				t2 = self.time()
    				response2 = var.keys[0]
    				response_time2 = t2 - t0 # caculates response time
    				exp.set('response2', response2)
    				exp.set('response_time2', response_time2)
    				if self.get('response2')==self.get('correct_response2'):
    				var.allkeys = [item for item in var.allkeys if item not in ['s', 'l']]
    				if var.allkeys == []:
    			# participant 3	
    			elif any(c in var.keys for c in ('z', 'm')):
    				t3 = self.time()
    				response3 = var.keys[0]
    				response_time3 = t3 - t0 # caculates response time
    				exp.set('response3', response3)
    				exp.set('response_time3', response_time3)
    				if self.get('response3')==self.get('correct_response3'):
    				var.allkeys = [item for item in var.allkeys if item not in ['z', 'm']]
    				if var.allkeys == []:

    First - thanks for your reply Eduard.

    This is where I'm at at the moment. It's not neat, my python knowledge is limited, but it is still the closest working version of the idea I'm trying to implement.

    As mentioned before, this covers points 1) and 2) and some of 3) (trial ends if all paricipants answered or after some time had passed) BUT:

    a) Countdown doesn't really count 10 sec, it stops the trial after aprox. 16.6 sec. It seems like I've implented it wrong in some way.

    b) Since my stimulus isn't static, using time.sleep (I've also tried core.wait) results in the stimulus freezing for the sleep/wait duration. I want to stimulus to keep 'running' for a shortwhile after last participant's key press.

    Would appreciate your input once again,


  • Hi Omer,

    I usually don't use pygame functions directly, so I'd need a little more time to read through your code and find out what went awry. Do you still need help on that issue?


Sign In or Register to comment.