Sign in with your CogSci, Facebook, Google, or Twitter account.
Or register to create a new account.
We'll use your information only for signing in to this forum.
Can I change the script so the program accepts Farsi text input which is right to left?
For text input the situation is pretty much the same as for text output. It can be done, but it requires inline scripting. Below you see simple script, adapted from this discussion, that gives a very simple example of how you can implement right-to-left text input.
For more information, see the code comments in the script and these documentation pages:
from openexp.canvas import canvas
from openexp.keyboard import keyboard
my_canvas = canvas(exp)
my_keyboard = keyboard(exp)
resp = u'' # Here we store the response
# Start with a clean canvas
# Get a keyboard response
key, time = my_keyboard.get_key()
# If return is pressed the loop should be exited.
if key == u'return':
# Handle backspace by removing the last character
if key == u'backspace':
resp = resp[1:]
# Convert 'space' to a space character. Other
# characters can be recoded in the same way.
if key == u'space':
key = u' '
resp = key + resp
# Show the canvas
# Save the response
There's much bigger issues in the world, I know. But I first have to take care of the world I know.
Thanks for the information. I am just want to add to my question that the program needs to wait 30 seconds then the participants can write all of the words they can, so the target response isn't a single key. Does this make any difference in the inline_script?
The script collects a string of text input until the participant presses return. So I imagine that's what you need. If you want to add a 30 s pause to your experiment, you can simply insert an advanced_delay item (or some other item that introduces a pause) before the inline script.