Howdy, Stranger!

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

Supported by

How to align text left that is displayed via Canvas.

edited March 21 in OpenSesame

Hi folks,

This may seem a bit of a daft question but as of typing this I can only see an instruction for 'center = True' when it comes to aligning text.

Is there a way to align the text to the left edge of the display in Canvas, other than inputting x-coordinates?

I can make it work using x-coordinates but I'm just wondering if there is a 'proper' way to do this?

Thanks,

Boo.

EDIT: I've just noticed that using the x-coordinate (a fixed global variable for all text from a dictionary) approach that the text, while aligning left, doesn't always start at the exact same place. I don't understand why that would be. The shorter the sentence the further right it starts. Any ideas?

Example of how I align left using the x-coordinate:

Question_Stim_Canvas['presented_text'] = Text(var.Question_Presentation[var.Temp_List_Trial_Count], color = var.Txt_Colour, x = var.Align_Left)

var.Align_Left is a global variable that I input a minus value to move left on the x-axis.

The stimuli themselves are pulled from dictionaries.

Comments

  • edited March 21

    To clarify: I want a sentence aligned left, in the centre of the y-axis, and the first character to start at the x-coordinate I input.

    As I said above, while the text is now positioned to the left of centre the first character is not matching the x-coordinate I'm inputting in the canvas. In the example above, I use a global variable for the coordinate. However, when just inputting a number for the x-axis value it still isn't starting the text exactly where I tell it to. There's very noticeable variation. This is confirmed via rect coordinates that I'm saving for purposes of Areas of Interest.

    If the sentence is short its closer to the centre of the display; if the sentence is too long it actually disappears off the screen to the left.

    Any idea why this might be happening?

    Could this be related to a resolution issue? When I input the actual size of the resolution in OpenSesame on this Mac it doesn't display properly. The Eye-tracking calibration stimuli was also "off the screen". I had to half the inputted resolution to get the eye-tracker calibration stimuli to appear where expected. I understand that if OpenSesame is being resized that the terminal should indicate this when using PsychoPy (which I am) but I don't see anything suggesting that is happening (what should it say?).

    I'll keep trying to get to the bottom of it for now and will report back if I figure this out.

    Thanks,

    Boo.

    PS: (in case this is somehow related) I always get warnings saying things like "X Coordinate "[Align_Left]" is unknown or variably defined, using display center" when using global variables in the couple of Sketchpads I use. Another - Color "[Txt_Colour]" is unknown or variably defined, using placeholder color." Worth noting in this last example that the instructed colour works perfectly well. Just thought I'd mention it as it's another mystery to me and may be somehow related.

    EDIT: I've tried this paradigm on a Windows 10 PC and have the exact same issues as with the MAC. I've tried to upload the paradigm here but keep getting a "Request failed with status code 500" message so here's a Dropbox link with the file: https://www.dropbox.com/sh/ahzassu01gezmry/AAB9n0Dsjx4HsR7eWcoFWdqHa?dl=0

    The Letters "z" and "m" will advance screens where responses are allowed. The EyeTracking is set to dummy mode. Change the value "Align_Left" (in the inline_script called 'Attributes_inline_Script") to change the x-coordinate used for test stimuli.

  • Hi folks,

    Sorry for the bump, but any thoughts on my issue above?

    Note: I've linked my paradigm above too.

    Thanks,

    Boo.

  • Hi folks,

    I still haven't got to the bottom of this and can't proceed with starting the experiment until I do.

    I'm totally baffled.

    Any insight would be appreciated.

    Thanks,

    Boo.

  • Hi Boo,

    Could it be the centered variable of a Text object? https://osdoc.cogsci.nl/3.2/manual/python/canvas/#function-canvas46text40text-centertrue-xnone-ynone-max95widthnone-4242style95args41

    If you, set it to True the x coordinate corresponds to the center of the string that is passed into Text(), if you set it to False, it corresponds to the left beginning of it. Could this be the issue?

    Can you upload your experiment?


    Eduard

  • Hi @eduard,

    I'll check out your link later today. Thanks.

    Regarding the experiment, I have included a link in a message above to a shared folder in Dropbox that contains the experiment. It won't upload here for some reason, that's why I used Dropbox.

    Thanks,

    Boo

  • Hi again @eduard,

    Your suggestion appears to be the source of the issue!

    Thanks so much, I was slowly going bonkers.

    I have to say you're a hugely valuable member of the community here. Keep up your awesome work.

    Thanks again,

    Boo.

Sign In or Register to comment.