psychopy.org | Reference | Downloads | Github

How to display counter variable on screen as text

Description of problem:

I am making a counter variable to track how much money participants have earned in my task and want to display that value so that they can track their earnings. The variable is called MoneyCounter - how can I display the value of this variable throughout the experiment as text in the top corner of the screen?

Option 1: Add a text component to every routine with the value $str(MoneyCounter) set every repeat.

Option 2: Add a text component in the first routine (e.g. called MoneyText and then in the next routine put MoneyText.setAutoDraw(True) in Begin Routine
Then put MoneyText.text = str(MoneyCounter) at any point when the value may have changed.
Then put MoneyText.setAutoDraw(False) at the end of the experiment.

Thank you so much!