Using my laptop screen to show trial nr results in lagging of experiment on monitor

OS (e.g. Win10): Win11
Standard Standalone? yes
What are you trying to achieve?: I am setting up an experiment on a monitor. I want to get the trial nr on my own laptop that is attached to the monitor.

What did you try to make it work?: I have tried to simply print the trial number in the runner while executing the experiment, but this lags and therefore not accurate. Now I am trying to use my laptop as a second window and show the trial number as text there. I have used the following code in a code component:

laptop_win = visual.Window(size=(400, 200), units=‘pix’, fullscr=False, pos=(100, 100))

trial_number_text = visual.TextStim(laptop_win, text=‘’, pos=(0, 0), height=30, color=‘white’)

total_trials = 168

for trial_number in range(total_trials):
trial_number_text.text = f’Trial {trials_conditions.thisTrialN}’


What specifically went wrong when you tried that?: In principle, it seems to work but I am running into issues with the timing of my experiment. It results in about a 1 sec lag when trying to continue to the next trial. I believe it might be due to the laptop_win.flip(), because without this line, the timing is good again (but the trial nr is not displayed).

I am sorry if anything is unclear, I am a beginner in psychopy so I hope I explained it understandable. Thanks in advance!

So I resolved this issue by removing the for loop, I think this slowed it down. The code is already within a loop that I have created in the builder, so it works perfect without it!

Sorry for making a “useless” topic, but I hope someone still might think it is useful one day.

.flip() shouldn’t be used in Builder, because there is an automatic flip at the end of each frame.

Your for loop was changing the text for all 168 text components on every trial (assuming your code was in Begin Routine)

1 Like