Is there any keyboard response function in PTB which takes a string as a keyboard response,say ‘ABC’ instead of just a single key and use that as condition to present an image.
Not that I know of, but it should be fairly straightforward to write. Simplest of course is just 3 KbWait
calls, but more flexible are the Kbqueue
functions: read >>doc KbQueueCreate
and use these various functions to create a keyboard queue, KbQueueCheck
returns a list of which keys were pressed when (all keyboard functions use a 256 long table, use KbName
to find which key maps to which number). You can then make sure it follows the order you want, and if it matches then you can show your image.
thanks
That solution would only work if each key is to appear once. Perhaps
help GetString
is what you are looking for? There is also
GetEchoString
if you want to make what is typed visible
There’s GetEchoString() and Ask() (if you set the replyfun parameter to ‘GetChar’) for that. It’s very basic, for simple word entry.