Problem with getting text to show up bold

Hi! I’m trying to display text in bold. I’m using Builder on a Mac, Psychopy version 2020.1.2.

Here’s what I’ve tried so far:
(1) Typing ** text ** and < b > text < /b > (without spaces), or text.bold = True before the text. In all of these cases, the text just appeared that way in the experiment without bolding.
(2) I’ve added bold = True to the TextStim arguments, but the text still didn’t appear bold when I ran the experiment. Adding other arguments worked, but not bold.
(3) I downloaded the newest version of Psychopy, and tried adding a textbox (instead of a regular text stimulus) and checking ‘bold’. However, adding the textbox causes the experiment to crash when I run it.

I’m ultimately hoping to run the experiment online on Pavlovia.

Thank you so much! Any help would be greatly appreciated :slight_smile:

Textbox is still very much in Beta so it could be that whatever was causing it to crash has been fixed since 2020.1.2 (we’re up to 2020.2.5 now), the first solution definitely shouldn’t work as Text components do not support HTML or setting its own parameters from within the Text field. Having bold=True in the arguments should work however, so could you try again in the latest version and let me know if it still breaks?

Thanks for the response! I’ve tried using a textbox and adding bold=True into the arguments in the 2020.2.5 version, but I’m having the same problems unfortunately. Textbox still crashes the experiment and adding bold=True (as below) doesn’t bold the text (though the experiment runs fine otherwise).

question = visual.TextStim(win=win, name=‘question’,
text=‘Which do you prefer?’,
font=‘Courier New’,
pos=(0, 0.7), height=0.1, wrapWidth=None, ori=0,
color=‘black’, colorSpace=‘rgb’, opacity=1,
languageStyle=‘LTR’, bold=True,
depth=0.0);

If you’re coding rather than using Builder, the Textbox class you want is actually Textbox2 (Textbox was an earlier draft)

I’m mostly using Builder, but have gone to the code because I don’t see a way to add the bold=True argument in the Builder. I’m using Textbox2 in the code, and it’s still crashing. Thanks for your help!

There should be a tickbox for “Bold” in Builder for Textboxes, if this is ticked then it should add bold=True to the code. Could you share the psyexp file you’re working with? I’ll have a look at how it’s compiling

There is an easier way. If your text format is utf-8 yoy may use a text generator (as Bold and Italic Text Generators - 𝐁𝐨𝐥𝐝 𝒂𝒏𝒅 𝑖𝑡𝑎𝑙𝑖𝑐𝑠) to find the bold characters for your text.

Thank you – I can confirm this works online. https://run.pavlovia.org/test-suite/text-formatting

Builder

However locally (in 2023.2.3) it comes out as

and shuts down my PsychoPy after every run (whether finishing normally or via pressing escape)

Thank you, I didn’t notice before this issue. It seems to be a trouble from Python, I tried to paste on the terminal in Psychopy and I see the same empty boxes. I guess that It may be related with some difference between utf-8 and utf-16 encoding.