[solved] OpenSesame virtual keyboard/numpad
Hello!
In my experiment, I would like my participants to solve equations by clicking on an on-screen numpad.
Using the documentation (http://osdoc.cogsci.nl/2.8/python/keyboard/#keyboard.show_virtual_keyboard) I tried this in an inline scipt:
from openexp.keyboard import keyboard
my_keyboard = keyboard(self.experiment, keylist=['1', '2', '3'])
my_keyboard.show_virtual_keyboard(True)
response1, timestamp2 = my_keyboard.get_key()
response2, timestamp2 = my_keyboard.get_key()
my_keyboard.show_virtual_keyboard(False)
But nothing appears on the screen... In the 'keyboard.show_virtual_keyboard(visible=True)' function description it says that it does not work for all back-ends, but I tried all of them and it didn't work for any of them...
Does anyone knows how I can get an on-screen keyboard/numpad in OpenSesame?
Comments
Hi Merel,
Right now the virtual keyboard is only applicable when running experiments on Android. What exactly do you want to do? Of course, you could implement something like an on-screen numpad with a bit of scripting.
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thanks for your reaction! Ah, allright that explains why it didn't work. I have a new idea, maybe I can make it work by showing a numpad made out of butons a couple of times in a row, which gives the participants the 'illusion' of using a numpad. Because, it is not possible to press more than one button in the same widget right?
Something like this:
Hi Merel,
Using a form to implement a numpad is not a bad idea!
Correct, but you can re-execute the form until the participant presses the enter button. And then you can use the return value of
form._exec()to keep track of the response. I modified your script to illustrate the basic principle.Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Nice addition to show the participants their response!
Maybe I should also add something that they can change their response if they accidentally press the wrong button, with a 'backspace' button or something like that. Otherwise it may be a bit confronting for them to see there response 
Jeej adding an extra button and replace the while loop with this works
:
Perfect!
Check out SigmundAI.eu for our OpenSesame AI assistant!