Howdy, Stranger!

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

Supported by

Can not use variable from one 'form' into another


I am trying to create a test in which the participants are given the choice between 7 colors. When they choose the color a list of words will be shown in that specific color. After that I want the participants to write down the words that they remembered, but I want the text that they write to be of the same color. I managed to make the list of words appear in the color selected by the participant but not to make the words that they will write in the same color.

The variable that the form gives me is color_choice which I then use in a sketchpad to change the color of the words like this color="[color_choice]" but then when I want to use it in the form of the text like this** set foreground=[color_choice]** it says that color choice does not exist.

What should I do?

Thank you.


  • Hi vleid,

    to set the colour of a TextLine stimulus, you need to give it the argument text_colour, which has to be a list with three arguments representing RGB values.

    I am afraid I do not fully understand the rest of your question (e.g. it is not clear to me what "form" and "sketchpad" you are referring to). Maybe you can give an example of the Python code that generates your colour list?

    Florian Krause (Developer)

  • Hi fladd,

    define form_multiple_choice new_form_multiple_choice
    set timeout infinite
    set spacing 10
    set question "Please choose a color that your prefferd color from the following list:"
    set margins "50;50;50;50"
    set form_var color_choice #this is the variable in ehich I store the color
    set form_title "Color choice"
    set description "A simple multiple choice item"
    set button_text Ok
    set allow_multiple no
    set advance_immediately no
    set _theme gray

    This is a form from which the color of the words can be chosen.

    define form_text_input new_form_text_input_2
    set timeout infinite
    set spacing 10
    set rows "1;3;5"
    set only_render no
    set margins "50;50;50;50"
    set form_var response
    set form_title "What do you recall"
    set form_question "Please fill in all the words that you remember. Separte the words by a space. Write the words in lower-case letters. Please mind the spellig, words not spelled correctly will not be considered as an correct answer. After you finnish please press ENTER to continue."
    set foreground "self.get"
    set description "A simple text input form"
    set cols 1
    set _theme gray
    widget 0 0 1 1 label text="[form_title]"
    widget 0 1 1 1 label center=no text="[form_question]"
    **widget 0 2 1 1 text_input focus=yes return_accepts=yes stub="" var="[form_var]" ** # I want this text to be the same as the color they have chosen

    and this is the form in which I want them to enter their response.

  • Mmh, this is not Python code. I think you accidentally posted in the wrong forum. This is the forum for Expyriment, which is a Python library for designing and conducting experiments.

    It looks to me that you are using OpenSesame. I will hence move this discussion in the OpenSesame forum.

    Florian Krause (Developer)

  • oh, ok thanks

Sign In or Register to comment.