Howdy, Stranger!

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

Supported by

Forms/Widgets: image as background for form

I would like to use an image (.png-file) as background for a form and would like to place the text_input widget on that image. So far, my workaround is to place the text_input under an image widget. Any idea on how to implement that (if it’s possible at all?).

Here’s the code for my form:

set timeout infinite
set spacing 5
set rows "7;1"
set only_render no
set margins "0;0;0;0"
set description type_occupation
set cols 1
#set background "image.png"  # => something like that would be nice
set _theme gray
widget 0 0 1 1 image path="[face]"   # this is my workaround
widget 0 1 1 1 text_input focus=yes return_accepts=yes var=response_get_occupation_input

PS: OpenSesame is really an amazing tool! As an experienced Presentation(R) and Matlab user, I wanted to switch to an open framework to implement my experiments. OpenSesame seems to do the trick! I managed to build several decent experiments within only a few hours! Keep up that amazing work!


  • Hi,

    You cannot easily add a background image to a form, but a little monkey-patching will do the trick. Say that you have a file called my_background.png in the file pool and that your form item is called my_form, then the script below will accomplish this. Essentially, it adds an image to form's Canvas and in addition makes sure that it stays on the bottom.

    Note: This requires OpenSesame 3.2, which is currently in prerelease! Doing the same thing 3.1 is possible, but more of a hassle.

    def lower_and_show(c, element, show_fnc):
        """This is a decorator for the orignal"""
        def inner():
        return inner
    c = items['my_form']._form.canvas
    c['my_background'] = Image(pool['my_background.png']) = lower_and_show(c, 'my_background',


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

  • Hey Sebastiaan,
    I tried this code but it's not recognizing my form. Is there a way to select the form from a list so I'm sure that it is selecting the form? I get a message that says "name 'items' is not defined". What does that mean?

  • Hi Patricia,

    The items object did not exist in older versions of OpenSesame. Are you running an older version? If so, then I would update to the latest version (3.1) or better yet get a prerelease of 3.2.


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

  • I have the newer version. I haven't upgraded to 3.2 but it might be a good idea for me to do that now. Is 3.2 'stable-ish'? I haven't started my project yet so the timing is ideal.

  • As far as I know, the release of 3.2 will happen soon-ish, so it should be stable enough. And for a couple of small example experiments, it was stable for me. Probably best, if you try and and if it works, you are good.


  • I installed the new version on the weekend and posted some issues in another discussion. This discussion can be closed. Thanks for you help.

Sign In or Register to comment.