Forms/Widgets: image as background for form
in OpenSesame
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!
Comments
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.pngin the file pool and that your form item is calledmy_form, then the script below will accomplish this. Essentially, it adds an image to form'sCanvasand 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.
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
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
itemsobject 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.Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
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.
Eduard
I installed the new version on the weekend and posted some issues in another discussion. This discussion can be closed. Thanks for you help.