Howdy, Stranger!

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

Supported by

Add image to form header

I've looked around the forum and the manuals but I can't seem to find how to do this. Our university is collaborating with 2 other universities and each has their own logo which they would like on all forms created for my experiment. I've seen how to add images to the form body but the image would likely need to be placed in the margin. Is this possible? If so, would you be able to direct me on how to do it using the Python inline script.


  • Dear Patricia,
    What you could do is create additional rows/columns around the widgets and leave these empty, except for the places where you put the logos, for example, in an inline script:

    from libopensesame import widgets
    var.logo = pool['some_logo.png']
    form = widgets.form(exp, cols=[1,2,2,1], rows=[1,2,2,1], margins=(50,50,50,50), spacing=25)
    image = widgets.image(form, path=pool['some_logo.png'], adjust = False)
    button1 = widgets.button(form, text='some button', var = 'response')
    button2 = widgets.button(form, text='some other button', var='response')
    button3 = widgets.button(form, text='second to last', var='response')
    button4 = widgets.button(form, text='the last of the butthikans', var='response')
    form.set_widget(image, (3,3))
    form.set_widget(button1, (1, 1)) # col, row tuple
    form.set_widget(button2, (2, 1))
    form.set_widget(button3, (1, 2))
    form.set_widget(button4, (2, 2))

    This would put the logo at the bottom right of the form, if you have more logos you would perhaps have to add multiple 'empty' columns, and play around with the relative width of the rows and the columns, hope this helps, good luck,

  • Hi OpenSesame Support: I was using the Questionnaire template and it was working fine. There was one little quirky thing. The word "Open question" show up in the screen even if you put text in. I can't find those words in the code at all so it makes it a bit difficult to fix. Any suggestions? I have added a picture.

  • Dear Patrica,
    As far as I know there is no questionnaire plug in, however there is a plug in for text called "form_text_input", and I am guessing you are using this. If this is the form you are using, then the stub can be changed by clicking on the right top and going to 'View script' over there on the last line there should be an argument called 'stub' if you keep this empty, as in the image, there should not be any text in the form. After this you have to click 'Apply and close' (also located at the right top). If this does not work, or if you are using a different plug in let me know, it should be possible to figure out, good luck


    1.png 47.6K
  • Hi Roelof:
    The "Get Started" page has a "Questionnaire Template" which is the one I was using.
    I checked the stub and provided a picture and its empty. So I'm not sure where this "open question" is coming from.

  • Dear Patricia,
    Apologies, I was not aware of the template, the template does indeed use a 'text_form input'. The "Open question" comes from [question_text] this refers to the variable 'question text' in the loop table, you can either delete this text, or just replace the variable in the loop table with your text.

    My previous assessment that this might be a stub was incorrect, the "open question" actually belongs to the text of the question, but falls slightly outside the margins, hope this works out, good luck,


    PS: there is also a consent form plug in:

    2.png 68.6K
  • Worked perfectly thanks. It was a little confusing because it didn't say "Open text" but once I deleted that, it worked.
    I'm trying to find the specifications for where the code puts the display window (i.e., the window that displays the information to the participant) on the screen. Mine seems to show up off-centre (shifted in from the left and down from the top). I thought it might have to do with screen size but that doesn't work. I defined my resolution as slightly smaller than the actual screen size.
    I am working through the help menus but the image header and positioning of the display screen I haven't found yet.

  • edited December 2017

    The way to place the items on the screen are determined by these two lines:
    set rows "1;1;6" set margins "50;50;50;150" # --> top:left:bottom:right

    The first line sets the relative spacing of the different items, the second line sets the margins, starting from the top, and cycling clockwise, so if your display is shifted to the right and down, you would have to reduce the first and second number in the margins line.

    see also:


  • I've used these settings. I was afraid it might not have been clear. The margins within the program are fine. I was referring to the pop-up window when you start the questionnaire template. When started a window with a white background opens with the information. I made my window larger. The spacing inside the window is fine. When I enter 10 for each value, the popup (popup2.jpg) is very close to perfect but when I enter a lower number, the popup shifts on the screen (popup.jpg). If I move it, the rest of the windows stay in place. I've tried higher and lower values and whatever I put in, other than 10, puts the popup further down and right (even if I change only the first two values).

  • Right, I am not sure I understand, you do not want the participants to view the questionnaire full screen, but present a specific pop up window in a specific location?

  • I think I might just change it to full screen. That would probably make it a whole lot easier.

  • Dear Roelof: That didn't work. The window/screen still shift to the right and down. I applied the "set fullscreen yes" and changed the size to the size of my screen but this is what happens (see attached)

    If I make the window smaller, I can access the buttons at the bottom but the popup window (the white window) is still shifted.

  • Right, that is somewhat odd; just to check; you changed the fullscreen in the backend settings to yes? And you are starting the experiment using the run full screen (green single arrow) button? (Also, which operating system are you using? and which version of opensesame?) Lastly, what would you like the behavior to be? I think indeed full screen would be the easiest, but other options are possible,

  • Dear Roelof: I think it means there is an error in my code somewhere. When there are no errors, the screen moves to where it needs to be.
    I was wondering if it might be easier to set the cols and rows to the maximum by default based on the resolution input. That way, the cols and rows is the same for all forms and the only thing the user needs to worry about is the placement values in the widget command.
    Is it possible to create a code-checker so that you don't have to run the program each time to see if it works?
    How would I get the python code for my OpenSesame code? When I change the option to Python, only the colour changes - the code stays the same.

    Merry Xmas!

  • Right, but just to check again; you changed the fullscreen in the backend settings to yes? And you are starting the experiment using the run full screen (green single arrow) button?
    Lastly, what would you like the behavior to be? I think indeed full screen would be the easiest, but other options are possible,

    You can use python functionality in the inline scripts, and there is a 'code checker' in the top right corner, that runs selected bits of code, happy holidays


    11.png 32.9K
  • I did change to full screen and ran the code but it would always pop the window down a bit and to the right. I found out that if my code had no errors, this would not happen. It's working at the moment.

    I posted a new question about loops on the forum.
    I haven't tried the inline script yet.

  • I decided to use sketchpads to display the logos instead. this posting can close. Thanks.

  • I was able to use a widget to create the logo in all the forms. This discussion can be closed. Thanks for your help.

Sign In or Register to comment.