Top of words being cut off - Textbox Beta

URL of experiment: THPN-1-IMG-21-V4 [PsychoPy]

Description of the problem: My experiment is pretty much up and running. However, there are a couple of outstanding issues that I cannot solve at the moment.

  1. I have had to use the beta text box to display word stimuli as I am using the Thai language and this wouldn’t display as a variable when using a regular text box (I can display static Thai text using a textbox but not when using a $ to display words from a list?). This brings a set of issues that you don’t experience when using regular textboxes, unfortunately.

Some Thai words are quite high vertically because of the way the vowels and tone markers are written into the script. Consequently, some “taller” words get partially cut off. You can see also that this doesn’t happen when using regular textboxes (text in green font on the same screenshots).

I’ve tried using \n in the Excel file (stimuli are in 3 separate Excel sheets, displayed as a variable in PsychoPy), but it just prints “\n” before each word on screen. So that doesn’t work in this instance.

I’ve tried using alt/enter in Excel to create a hard space and then I end up with a scroll box as the screen space is much larger i.e. you can scroll within the text box and see all of the stimulus. So that doesn’t seem suitable.

I’ve also tried adjusting the values for the beta textbox settings as well, but without any luck.

2… The second issue is that we cannot get the words to present in the centre of the screen. It’s not too bad for shorter words but very noticeable when the word is quite long, so it doesn’t look quite right unfortunately.

My beta textbox settings are:
Size: .6,.1
Position: 0, 0.2
Padding: 0
Spatial units: from exp settings
Anchor: top left
Orientation: 0
Courier New font; letter height: 0.075; line spacing: 1.0

Hopefully someone has had similar issues before and can provide a solution. They are relatively small issues but I’d like to solve them so that I can begin collecting data online.

Thanks in advance

What happens if you set the line spacing to 1.1? If you could post the characters used in the TextBox too that would also help, it may be that the glyphs of those characters in that font are bigger than the sizes reported by the python fonts package PsychoPy uses


Thanks for the reply. I’ll take a look at increasing the line spacing and see how I get on. In the meantime, here are some words that I am using. There are in an Excel sheet in Arial format but the font is New Courier in PsychoPy.


I’m not sure “New Courier” is a valid font name - you’re probably thinking of “Courier New”? So what’s probably happening is it’s defaulting to Arial online. Testing those characters they seem to work locally with the font Niramit - but this is a Google font and implementing these online is still a work in progress… In the meantime, I’d recommend trying all of the web safe fonts to see how they act:

Hi there,

I tried playing around with the line spacing option as well as all of the different web safe fonts. The best one seems to be Verdana but it still cuts off the very top of the string i.e. the second glyph gets cut off on those cases where there are two additional glyphs above the main character line. It doesn’t matter how high I go on line spacing either.

I also tried playing around with the “padding” option. This actually achieves the desired outcome; however, it prints a scroll box for the words that are higher vertically and you have to then scroll to see the whole word (see attached screenshots). This is not really a working solution.

What about spatial units? I’m using “from experiment settings”?

At the moment I’m stuck! Any other suggestions?


Ahh I see, if padding fixes it then it’s probably that part of the glyph was outside the bounds of the TextBox. The scrollbar appears if the total height of the text + the padding * 2 is greater than the height - so to get rid of it you should be able to just increase the height. If it’s one line of text, then the minimum value to have no scrollbar should (in theory…) be

letterHeight * lineHeight + padding * 2

Thanks, but how would I actually implement this in PsychoPy?

I’m only dealing with single words - one line of text.

Ok, after quite a bit of playing around I think I’ve managed to rectify the first issue. I adjusted the vertical height of the beta text box and played around with the wrapping parameter until it worked. I used Verdana font with the same size in the end and line spacing at 1.0. So it seems the two important parameters are size: adjusted to .6, .125 and padding: adjusted to 0.0075. Everything else remained as before.

I still have the issue of stimuli being presented at different horizontal positions according to their length, which isn’t ideal for a word-based experiment. It has something to do with the anchor point but playing around with this doesn’t seem to reach the desired outcome.

Any suggestions on presenting stimuli centralised?

Thanks and best wishes,


Great to know you’ve solved the clipping issue. I’d recommend starting a new thread for the horizontal alignment.

Thanks, I’ll do that.