Text/Font position
Hi,
In my experiment, I draw single letters/symbols in the center of the screen and alternate between them and a fixation dot. I noticed that while the fixation dot is nicely centered, the symbols/letters are not (always). For instance, a capital O or a + sign are, but a small x and a - are not. They appear slightly below the center of the screen. Keyword center is always on default (True) and x and y coordinates are the same between all stimuli (0,0). Is this because text/fonts are drawn as a picture with a dedicated area large enough to fit capitalized as well as small letters?
Either way, is there a way to make sure they are always properly centered without messing around with the x,y coordinates?
Thanks,
Michel
Comments
Hi Michel,
Not exactly, I think, but it must have something to do with the bounding box that is determined by the font renderer (which works in mysterious ways).
This would be a good moment to try the prerelease of 3.2, which uses an entirely different way to render text, and which should not suffer from this issue. If you try this, could you let me know how this works out?
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hey Sebastiaan,
I just tested it with the latest release I could find (opensesame_3.2.0a10-py2.7-win32-1) but could not get it to work. I am getting a bunch of other errors that do not seem to have anything to do with the issue at hand.
For example, this:
exception type: AttributeError
exception message: 'str' object has no attribute 'copy'
With:
var.dispSearch.copy(var.dispBlank)
And this:
After this line:
path_template = var.get_file('stimuli_out/'+var.cond_category+'//'+str(var.exemplarTemplate)+'.bmp')
So, at least with this build, I cannot test it out yet
Michel
As a side note: I am having issues with presenting images loaded in like above but only with the expyriment and legacy backend, not with psychopy. However, OS does not throw an error, it just does not present the images, while it does so when using the psychopy backend. I am gonna test whether that has anything to do with the specific images or format. If not, I'll create another thread for this issue.
Edit: Not sure whether that is a general issue or somehow related to the pictures I use but everything works fine when converting my .bmp pictures into .jpgs.
I can confirm that expyriment and legacy refuse to display
.bmps when using the canvas functions, whereas psychopy works. (And.jpgs work as well with all backends)Thanks for testing, guys! Once I'm back in Groningen, I'll fix these issue and build a new prerelease. (Assuming that they're easy to fix, but I assume so.)
Check out SigmundAI.eu for our OpenSesame AI assistant!
Just for clarification: the issue with the images was not specific to the latest prerelease version but already an issue on the latest stable version. I assume that it is really specific to the pictures. Eduard and I observed that other .bmps seem to work.
The errors posted in my second post however are specific to the prereleases.
Hi Michel,
Regarding the first error, resulting from:
Without more context, this strikes me as a problem with your script:
var.dispSearchis astrobject, whereas you seem to be assuming that it's acanvas. Or is there something more?Regarding the second error:
This seems to come from a call to
canvas.text(). Is that possible? What exactly triggers the error?Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hey Sebastiaan,
Regarding the first error:
I don't think it is a string variable. When checking their types they both show up as classes. Also, as mentioned, the same code works fine with the latest stable version.
I just noticed though that it might indeed become clearer if I send you the full error message. The second-last line suggests, as far as I understand it, that something fails in copying the to-be-copied canvas on the designated canvas.
Regarding the second error:
I just checked and you're right. After removing all canvas.text calls from the script (and the copy call from error #1), it works fine. Do I take from this that you will also change the name/keywords of the text-drawing function or is this still a bug?
By the way, I just noticed that the error message now indicates exactly the line where the error occurs rather than the previous line as it did in the past (that's also the reason why I copied the wrong line in my previous post), is that new or did I miss something?
Cheers,
Michel
PS: If you want to take a look at the script, see my email to you from last week. It should still be on my google drive.
Hi Michel,
As of 3.2.0a11, these issues should be resolved. Thanks for testing this.
That's new. The old behavior was of course unintended, and resulted from counting an invisible line that specifies the character encoding.
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!