Howdy, Stranger!

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

Supported by

[open] compound stimulus

edited June 2014 in OpenSesame

I am working on an experiment that uses a button composed of two images displayed side by side.
I have defined two image_button widgets and ideally, I would place them in the same widget column-row form. (But that does not work, only the last one is displayed).
Another approach would be to dynamically join the two images into a third one and use that one.
I was also wondering if OpenSesame supports the notion of group (multiple stimuli attached to the same "button"). I suppose I could implement this by attaching the same callback to multiple images.

Do you have any suggestions to implement this compound stimulus feature?

Thanks

Christophe

Comments

  • edited June 2014

    Hi Christophe,

    As it is now, the image_button only supports a single image at a time, I'm afraid. You could go for either of two approaches:

    1) Merge the images. You could do this beforehand, but this would be feasible only if you have a limited number of possible image combinations. You could also merge the images online, but you would have to save the combined image as a (temporary) file for it to work with the image_button, so you will be making a lot of image files anyway.

    2) Use two adjacent image_buttons, and give them the exact same response variable:

    from libopensesame import widgets
    form = widgets.form(self.experiment)
    # The full path to the image needs to be provided.
    # self.experiment.get_file() can be used to retrieve the full path
    # to an image in the file pool.
    image_button_1 = widgets.image_button(form, path=self.experiment.get_file('1.png'), var='response')
    image_button_2 = widgets.image_button(form, path=self.experiment.get_file('2.png'), var='response')
    form.set_widget(image_button_1, (0,0))
    form.set_widget(image_button_2, (100,0))
    form._exec()
    

    Good luck!

    Edwin

Sign In or Register to comment.