Howdy, Stranger!

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

Supported by

form_text_input/form_multiple_choice: Using space to continue


In my opensesame experiment, I want to implement some demographic questions in the end. I am currently using the form_text_input-item to ask about the participants' age and the form_multiple_choice to ask about their gender.

In the parts of the experiment that precede the questionnaire, the participants had to press the Space-bar in order to continue for example from a sketchpad to the next. I would now like to remain using the Space-bar for the questionnaire, so that the whole procedure is as easy as possible for the participants. Is it possible to change that the participants do not have to use a mouse-click response (like for the form_multiple_choice) or press enter (as for the form_text_input) but instead the Space-bar?


  • Hi @SQuestion,

    I think that because the form_text_input object is designed to accept text, the space bar response is regarded as part of the text inputted by the participant. There may be a way to use code to monitor the content of the text to intercept a space bar response, and to do something similar with the form_multipe_choice object, but I'm not sure how to go about doing that and I suspect it might be tricky and perhaps not worth the trouble.

    However, an alternative would be to display your questions on a sketchpad and use a modified version of the code posted by Sebastiaan here to track the text inputted, display it on the screen, and take the space response as the response that moves to the next object in your experiment. I adapted the code slightly to take the space bar as the response to move on to the next object. You can download below and adapt it to your needs (for example, you might want to implement a check to make sure that the experiment does not move on if the participant didn't type anything, or even to check that it is a numerical value in the case of the age question; you'd have to research Python language a little to work out how to do that):

    Of course, a simpler solution would be to just make clear on your screen what participants must press to move on to the next screen. Sure, the coherence across the experiment would not be perfect, but that would spare you some coding.

    As for the sex question, you could simply use a sketchpad + keyboard input object with instruction to press M for male and F for female, rather than using a multiple choice form. Then it would be very simple to take the response, and define the space bar as the key to press to move on. Seems a lot simpler to me.

    Hope this helps,


    Buy Me A Coffee

  • Hi @Fab,

    Thanks a lot already! I realised that I can only open .opensesame files but not the .osexp files, but have no idea why or how to change that.. Do you maybe know what I can do?

    Kind regards!

  • Hi @SQuestion,

    I think you're using an outdated version of Open Sesame. What version are you using?

    Since version 3.0, experiments are saved in .osexp instead of .opensesame (see

    I recommend you download the latest version. Version 3.3.10 just came out:

    In principle you should be able to open your old .opensesame file and read .osexp files.

    Kind regards,


    Buy Me A Coffee

  • Hi @Fab ,

    Although I asked my last question regarding this topic some time ago, I still have another problem with the questions I implemented.

    In my experiement, you can find a questionnaire at the bottom. My problem here is that pressing the "Shift"-key in the sketchpad (for each question) does not cause the letters to be "big" but rather the word "shift" is spelled out. This may confuse participants. Same thing happens with some other keys.

    Furthermore and probably even more disturbing is the fact that participants can not deleate the first letter or number they typed into the skechpad-response field. If there is only one letter/number in the answer field and a participant presses the backspace-key, a white screen occurs from which you can continue by pressing the space bar. If a participant typed in => 2 letters/numbers, it is possible to use the backspace-key to delete what is typed in (except for the first number/letter; then the white screen occurs).

    Is it possible to a) change that the keys like shift really function and not only spell out what they should do? Is it b) possible to implement that participants can also delete their first letter/number without the whole sketchpad "vanishing"?

    I attached my experiment.:)

  • Hi @SQuestion,

    I had a quick look at the questionnaire bit of your task. I noted that you're still using an outdated version of Open Sesame. Not sure that the version you're using includes the form objects but I suspect it does not. You'd make you life easier by using the latest version of OS and collecting your responses using the form_text_input object. No more playing around with canvases or having to deal with special keys like left shift etc.

    With your code as it is, the issue of special characters can be dealt with with more code. Basically, you want to adapt the code to catch cases where participants press keys like left or right shift. The same way to delete the last character from the resp variable when they hit backspace, you can delete the last n characters when they press, say, the left shift key. The number of characters to remove is the length of the string value of the key they pressed (e.g., "left shift" is 10 characters long).

    This is code you could use for each of the sketchpads in your questionnaire. Here, I modified the one for for "gender" question.

    from openexp.canvas import canvas
    from openexp.keyboard import keyboard
    my_canvas = canvas(self.experiment)
    my_keyboard = keyboard(self.experiment)
    resp = "" # Here we store the response
    while True:
                   # Get a keyboard response
                   key, time = my_keyboard.get_key()
                   # keyboard.to_chr() converts the keycode to a description,
                   # like 'space' or 'return'. If return is pressed the loop
                   # should be exited.
                   if my_keyboard.to_chr(key) == "space":
                   # Handle backspace by removing the last character
                   if my_keyboard.to_chr(key) == "backspace":
                                   resp = resp[:-1]   
                                   # The built-in chr() converts the keycode to a character,
                                   # like ' ' and '/'.
                                   resp += my_keyboard.to_chr(key)
                                   if key.isalpha() :
                                                   print("\n" + key +" is A LETTER.")
                                   elif key.isdigit() :
                                                   print("\n" + key +" is A DIGIT.")
                                   else :
                                                   print("\n" +key+ " is A SPECIAL CHARACTER.")
                                                   resp = resp[:-len(my_keyboard.to_chr(key))]
                   # Copy the canvas from a sketchpad called 'my_sketchpad' and
                   # overlay the response
                   print ("key: "+my_keyboard.to_chr(key)+" "+str(len(my_keyboard.to_chr(key)))+" chr:"+key)
    # Save the response
    self.experiment.set("gender", resp)

    In the code above, you can see that if the key pressed is not SPACE or BACKSPACE, the code will distinguish between letters, digits and other input. In the latter case, the number of characters from the last key is removed from the resp variable: resp = resp[:-len(my_keyboard.to_chr(key))].

    Regarding the issue of the blank screen, it has to do with the use of the copy function. You can see in the documentation that there is a warning of unpredictable behavior when using this function:


    Copying Canvas objects can result in unpredictable behavior. In many cases, a better solution is to recreate multiple Canvas objects from scratch, and/ or to use the element interface to update Canvas elements individually.

    To be honest, I'm not sure how to go about solving that.

    My recommendation is to upgrade to the latest version of Open Sesame and make use of the form objects to implement the questionnaire part of your study. It'll work much better and it'll save you a lot of coding.

    Hope this helps.


    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games