Howdy, Stranger!

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

Supported by

How to translate python inline script canvas to javascript

Dear OpenSesmae community,

I have an experiment using legacy backend in which the main trial slide is created manually using the Canvas class in python inline script.

I'm now interested in running the experiment online.

That's how the canvas is produced:

template = '<span style="color:rgba(0,0,0,0.01);font-family:mono;">yX</span>%s<span style="color:rgba(0,0,0,0.01);font-family:mono;">yX</span>'


my_canvas = Canvas()
my_canvas['LeftText'] = Text(template % var.VarA, x= -100, y=0, center=True,font_size=var.SizeA,   font_family = 'mono')
my_canvas['RightText'] = Text(template % var.VarB, x= 100, y=0, center=True, font_size=var.SizeB,   font_family = 'mono')
my_canvas.show()


I'm a newbie to javascript but I am open to learn. Neverthless I am really lost with this one....


Can you help me with this conversion? Any sources to learn from?

Stay self and healthy,

SH

Comments

  • Hi SH,

    according to the OSweb documentation:

    "You cannot create Canvas, Keyboard objects, etc."

    So unfortunately, I don't think there is a way of doing it. Maybe you can manage to implement the same functionality with a sketchpad?


    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    Thank you so much for your response!

    The reason I'm using the inline script is due to this issue.

    It seems like this issue is solved for the new OS version. should I move my exp to the new version and try it from there?

  • Sounds like a plan!

    Buy Me A Coffee

Sign In or Register to comment.