Howdy, Stranger!

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

Supported by

[solved] two images by canvas function

keikei
edited September 2015 in OpenSesame

Hi,
I'm now moving to inline scripting for making program. I have a simple question: how can I show two images simultaneously on screen by canvas.image function? I simply wrote:

(in preparation tab)

from openexp.canvas import canvas
my_canvas = canvas(exp)
path = exp.get_file('Stim.png')
my_canvas.image(path,-400,0)
my_canvas.image(path,400,0)
my_canvas.prepare

(in run tab)

my_canvas.show()

-

This showed only one image, but not two images. Please advice me if I mistake scripting!
Hiro

Comments

  • edited 10:19AM

    Hi Hiro,

    You're running into a weird property of OpenSesame: In Python code, 0, 0 is the top-left of the display, and not the center. So you're showing the first image outside the display boundaries.

    So you'll want to do something like (note also the parameters to canvas.image):

    from openexp.canvas import canvas
    xc = self.get('width')/2
    my_canvas = canvas(exp)
    path = exp.get_file('Stim.png')
    my_canvas.image(path,x=xc-200)
    my_canvas.image(path,x=xc+200)
    my_canvas.show()
    

    By the way, this annoyingly inconsistent behavior will be improved in OpenSesame 3.0.0!

    Cheers,
    Sebastiaan

  • keikei
    edited 10:19AM

    Thanks! I can solve it.

Sign In or Register to comment.