Howdy, Stranger!

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

Supported by

[solved] 1-digit-constrained visual feedback on Likert-scale questions until Return is pressed?

edited March 2013 in OpenSesame

I'm trying to use loops to administer a bunch of Likert-scale questionnaires to participants. I have looked at the multiple-choice plugins which are really slick, except that (a) I haven't figured out yet how to interpret the data files they generate, and (b) I'm afraid that 300 questions with their mouse interface will give my participants carpal tunnel syndrome. Instead, if possible, I'm trying to present the questions, with text drawn from a variable in a loop, on a sketchpad, with the response options (e.g., 1 2 3 4 5 6 7). The participant's answer is constrained to a single digit, from 1 to 7. So far so good, except that I would like the participants to see feedback for the answer they have chosen (e.g., the number the pressed showing up in the center of the screen or something), and that feedback should change if they press another key (e.g., their initial choice of 2 is replaced with 3 when they press the 3 key), and then the last choice should be written to the data file only when they press Return, which should advance them to the next item in the sequence.

Right now, in the trialsequence, I have (a) a sketchpad object with a reference to a variable with the question text, as well as a non-variable indication of the response options, (b) a keyboard response object with Allowed Responses as 1;2;3;4;5;6;7, and (c) a logger set, I think, to default values.

I feel I see very nearly the solution I need here:

http://forum.cogsci.nl/index.php?p=/discussion/31/solved-multi-character-keyboard-response-or-simultaneous-sketchpad-and-text_input/p1

except I'd like the keypress to be constrained to one digit, and have the visual feedback change in response to keypresses (only the allowed ones) indefinitely until Return is pressed. I've searched the forums, but haven't found anything so far. If I'm missing a post, I'd be happy to be referred to it. I know nothing about Python, so I haven't been able to work out, yet, how to get scripting to do what I'd like, but I'm willing to learn...

Any ideas?

Comments

  • edited 11:36AM
    I have looked at the multiple-choice plugins which are really slick, except that (a) I haven't figured out yet how to interpret the data files they generate

    They will set the response variable. So the idea is that you insert a logger after the collection of each response, and you will get a .csv spreadsheet where the responses are logged in the response column.

    I'm afraid that 300 questions with their mouse interface will give my participants carpal tunnel syndrome.

    That fear seems justified.

    I adjusted the script from the post you mentioned a bit. Again, you need to insert a sketchpad called my_sketchpad somewhere, such as right before the inline_script (with a 0 duration). The script below accepts only numeric responses 1-7, shows the current response, and accepts the response on 'return'. Is that about what you were looking for?

    from openexp.canvas import canvas
    from openexp.keyboard import keyboard
    my_canvas = canvas(self.experiment)
    my_keyboard = keyboard(self.experiment, keylist=['1','2','3','4','5','6','7', 'return'])
    resp = None
    while True:
        # Get a keyboard response
        key, time = my_keyboard.get_key()
        # keyboard.to_chr() converts the keycode to a description,
        # like 'space' or 'return'. If return is pressed the loop
        # should be exited, but only if a response has been given
        if my_keyboard.to_chr(key) == "return":
            if resp != None:
                break
            else:
                continue
        # The built-in my_keyboard.to_chr() converts the keycode to a character,
        # like '1' and '2'.
        resp = my_keyboard.to_chr(key)
        # Copy the canvas from a sketchpad called 'my_sketchpad' and
        # overlay the response
        my_canvas.copy(self.experiment.items["my_sketchpad"].canvas)
        my_canvas.text(resp)
        my_canvas.show()    
    # Save the response
    self.experiment.set("response", resp)

    For more information on the functions, see:

  • edited 11:36AM

    Thank you! That's exactly what I needed. I tweaked the feedback-text displayed just a little (position, color), and now it's amazing. I very much appreciate your help.

Sign In or Register to comment.