Howdy, Stranger!

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

Supported by

smiley in feedback canvas

edited May 8 in OpenSesame

Hi folks,

i would pretty much like to put a smiley into a feedback item in python code. Let's make a green happy smiley or a red sad smiley.
I tried it with the text smileys. ☹, ☺
But it seems like they are not provided. I get this rectangle presented (missing font).

This is part of my code:

FB2 = canvas()
FB2.text(font=('Arial',36),  text='falsche Tastendrücke:  ' +str(var.Resp_Perc_F)  + ' %' + 'smiley( happy or sad)'
+ '\n \n' + 'Zeit:  ' 
+format(var.Resp_MT/1000, '.2f') + ' sec' + '\n \n \n \n \n weiter mit Entertaste') 

I think I cannot put a .jpg into a feedback canvas, right?
Any other ideas?

Comments

  • Hi,

    In OpenSesame 3.2, presenting ☹ and other esoteric characters should work. It didn't work in older versions because these characters are generally not actually available in the font, and therefore the font renderer needs to be clever enough to get them from somewhere else.

    I think I cannot put a .jpg into a feedback canvas, right?

    Of course you can! What makes you think you can't?

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • To your question:
    I thought it'll be difficult to combine text (drawing from the vars) and pictures (.jpg) in one canvas.

    With OpenSesame 3.2 it works fine :) Thanks!
    I would like to change font_size and color of just part of the text (the smiley). I tried a lot, but cannot figure out how. I found the color='green' argument. But how do i implement it for part of the text? Do have a suggestion?

    var.X = 5
    FB1 = canvas()
    FB1.text(font=('Arial',36),  text=('falsche Tastendrücke  ' +str(var.X)  + ' %' + ('   ☹') #font_size=48, color='red'
    + '\n \n' + 'Zeit  ' 
    +format(var.X/float(1000),'.2f') + ' sec' + '\n \n \n \n \n mind. 30 Sek. Pause'))
    
  • Hi,

    As of OpenSesame 3.2, you can use full HTML in text elements. So the following will give you a green smiley in a text that otherwise that otherwise has the default foreground color.

    c = Canvas()
    c.text('Regular text with a colorful <span style="color:green;">☺</span>')
    c.show()
    

    Cheers!
    Sebastiaan

    Thanked by 1DahmSF

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Now color works nice! :) But why does font_size or font-size not work?

    c = Canvas()
    #c.text('Regular text with a big <span style="font-size:4em;">☺</span>') 
    c.text('Regular text with a big <span style="font-size:96;">☺</span>')
    c.show()
    
  • Hi,

    Does it work if you use this line:

    c.text('Regular text with a big <span style="size:96;">☺</span>')
    

    ?

    Eduard

Sign In or Register to comment.