Iowa Gambling Task - How to Change the Text Color of gain and loss in PsychoPy?

Hi everyone,

I’m working on a task in PsychoPy where I calculate gain and loss values after a participant selects a card from a deck. The calculations work fine, but now I’d like to display the gain and loss values on the screen with different text colors (e.g., green for gains and red for losses).

Here’s a simplified version of my code:

  • calculate gain and loss
    gain = deck_list[choice_idx][0]
    loss = card_list[(deck_choiceN[choice_idx]-1) % 10] * deck_list[choice_idx][1]

I want to display gain and loss with different text colors

How can I change the text color of these values in PsychoPy?

Thanks in advance!

IGT.zip (490.6 KB)

To display these text values you need to create a :text: Text or :textbox: Textbox Component, which has an attribute “Color” for its text color. Create one for gain (whose “text” value is $gain and its updates are “Set every repeat” or “Set every frame”) and one for loss (ditto but for $loss), and set the color of the gain Component to be “green” and of the loss Component to be “red”