This is quite a general post about the capabilities of presenting text stimuli in Psychopy, just to check that I’ve not missed anything.
I’d like to present a sentence (~60 characters) moving across the screen. It will be presented in the visual periphery, where crowding is prevalent, so I’d like to be able to independently control the letter spacing (increasing the letter spacing can alleviate crowding) and update positions on each frame. There are two options for displaying text in Psychopy, TextStim and TextBox, and as far as I can tell, neither allows control of inter-letter spacing. The solution that I have come to is that I’ll need to iterate through the sentence, setting the text object to be each single character from the sentence, and then update the text object position for each character. So, on each frame, I’ve got some pseudocode like this:
for charN in letters2disp:
>thisText.text = sentence[charN]
>thisText.pos = [nextPosition,0]
>thisText.draw()
win.flip()
[where > means indent]
I’m updating a single text object, rather than using a text object for each character, as this would become cumbersome (and memory hogging) very quickly. Also, the number of letters2disp may change, so a single object is much more flexible.
Given the drawing latencies for text stimuli (see the first table here: TextBox — PsychoPy v2021.1), I’m going to start running into problems quickly, trying to update and draw 60 characters per frame (~12 ms). Fortunately, in my case, I’m only displaying 5/6 characters per frame, through an aperture. So, I work out which characters will be visible and update their identity and position before flipping the win. However, even with 5/6 characters I feel like I might start to drop frames… and what if I’d like to increase the number of characters I’m displaying?
Some questions. Is there a way to very quickly update and draw text stimuli in Psychopy that I’m missing? Is there another solution to my problem that I’m missing? I’m looking at using TextBox, as TextStim is seemingly too slow to update >1 time during a frame, whereas I should be able to update TextBox 5/6 times during a frame (see ‘Change text + redraw time’ in the table referenced above). Is this problem with drawing latencies a general problem with displaying text or are there solutions readily available?