Displaying image in a canvas by referring to a variable using inline_script
Hi Everyone,
I have been building an experiment in which I am constructing canvases using inline_script, and I would like to display images by referring to a varialbe that contains the list of images. Ideally, that would be done with this function; however, the function does not work because it requires specifying the exact image path:
cv = canvas()
cv.image(var.Image, center=True, x=None, y=None, scale=None)
Does anyone maybe know whether it is somehow possible to display images by referring to a variable?
Thanks a lot!
Comments
Hi,
Assuming that the image is in the file pool and has the name
my_image.png, then you can get the full path to the image through thepoolobject, like so:So in your case you could present the image as follows:
For more examples, see:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thank you for the code, that works perfectly