Hank
Hank

Reputation: 569

Text with multiple colors in PsychoPy

I am messing around in PsychoPy now, trying to modify the Sternberg demo for a class project. I want the stimulus text—the number set—to display in a variety of colors: say, one digit is red, the next blue, the next brown, etc. A variety within the same stimulus.

I can only find how to change the color of the entire set. I was wondering if I could add another variable to the spreadsheet accompanying the experiment and have the values in the cells be comma separated (red,blue,brown…). Is this possible?

Upvotes: 3

Views: 1287

Answers (2)

Michael MacAskill
Michael MacAskill

Reputation: 2421

The current way to implement this is to have a separate text stimulus for each digit, each with the desired colour.

If the text representation of the number is contained in a variable called, say, stimulusText then in the Text field for the first text component put "$stimulusText[0]" so that it contains just the first digit. In the next text component , use "$stimulusText[1]", and so on.

The colour of each text component can be either fixed or vary according to separate column variables specified in a conditions file.

Upvotes: 2

Jon
Jon

Reputation: 1223

No, that isn't possible right now. There's an experimental new stimulus class called TextBox that will allow it, but you'd have to write code to use that (not available yet from the Builder interface). Or just create some tif images of your stimuli and use those?

Upvotes: 5

Related Questions