View Single Post
  #1  
Old 04-27-2013, 05:21 PM
javadi javadi is offline
Member
 
Join Date: Mar 2013
Location: London
Posts: 33
Key presses, waitKeyDown

Hi

I have a few questions regarding registration of key presses. I noticed that the frequency of registration of key presses using 'waitKeyDown' function depends on the Windows' Keyboard Property, e.g. if you set the 'Repeat Rate' to 'Slow', this function checks the keyboard slower than 'Fast'. I used the following code to test this.

Code:
import viz
import viztask

viz.go()

def Keyinput():
	while True: 
		k = yield viztask.waitKeyDown(None)
		print 'key', k.key, 'was pressed'
	
viztask.schedule(Keyinput())
  1. I am wondering whether there is any way to read the keyboard with a certain speed regardless of this property.
  2. Moreover, from our experience of Linux and lots of other tools like Psychtoolbox in MATLAB (even in Windows), we know that key presses can be readout much faster than what 'Keyboard Properties' specifies. For example Psychtoolbox reads keyboard every few milliseconds. How can we read the keyboard with such temporal precision?
  3. One final question. If you press two keys simultaneously, waitKeyDown only returns the latter one. And if you release the latter one, it doesn't return anything anymore, i.e. it doesn't recognise that still one key is pressed. How can we access all the simultaneously pressed keys?

Very many thanks.

Greetings :-)
Amir
Reply With Quote