Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Bold text in inline script

Hi,
I've been trying and searching for a while, and before giving up I wanted to give the forum a go.
I'm programming a name-letter task in opensesame, using a simple inline script form with widgets. Participants see a letter, and rate this letter on a 5 point scale. The letters are presented in random order taken from a loop ('var.alfabet'), everything fine so far.
But now I want to make the letter (e.g. "M") stand out a bit from the other text on the form, preferably by making the font size bigger and bold faced. Is there a way to do this?

This is my script (experiment is in Dutch, but translated to English here):

set description "Executes Python code"
_run
from libopensesame import widgets

form = widgets.form(self.experiment, cols=[1,1,1,1,1,1,1], rows=[1,1, 1, 1, 1])

Letter = widgets.label(form, var.alfabet)
Question1 = widgets.label(form, text= "How much do you like this letter?")
Question1Label1 = widgets.label(form, text='I don't like this letter')
Question1Label2 = widgets.label(form, text='')
Question1Label3 = widgets.label(form, text='I like this letter')
Question1Scale = widgets.rating_scale(form, var='scale4', nodes=['1', '2', '3', '4', '5'])
buttonNext = widgets.button(form, text = 'Next')

form.set_widget(Letter, (3, 0), colspan = 1, rowspan=1)
form.set_widget(Question1, (0,1), colspan=7)
form.set_widget(Question1Label1, (0,2), colspan = 1)
form.set_widget(Question1Label2, (3,2), colspan = 1)
form.set_widget(Question1Label3, (6,2), colspan = 1)
form.set_widget(Question1Scale, (0,3), colspan=7)
form.set_widget(buttonNext, (5,4), colspan=2)

button_clicked = form._exec()

var.LettLike = (var.scale4 + 1)

end
set _prepare ""

Comments

  • Hi Ilja,

    i am quite sure you need to change something in this line:
    Letter = widgets.label(form, var.alfabet)

    Try to add font_size = 32, color = 'blue' , or font_bold = True.
    I am not sure, but maybe like this Letter = widgets.label(form, var.alfabet, font_bold = True)

    Hope this helps (at least for futher ideas)
    Stephan

    Thanked by 1Ilja
  • Hi Stephan,

    Thank you for your suggestion! I tried this, but unfortunately it doesn't work...

    I expect it can be solved using either this function (but I don't know how exactly):
    function label.draw_text(text, html=True)
    Or by using html in another way than how I used it now. But so far, no success.

Sign In or Register to comment.