Howdy, Stranger!

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

Supported by

Possible glitch recording keypress

Hi there!

I am running an experiment where I get a longer keyboard response from the participant on several occasions. I adapted the code from this forum post, and it works perfectly when I run the experiment in Quick Run mode. However, when I run in the window or fullscreen mode, capital letters fail to register as a response. For example, if I were trying to enter "Forest", it would register as "orest". Perhaps the weirdest part is that this happens only during one portion of the experiment, and I am unable to find any difference between the code in this section and later sections in which it works fine, even in window and fullscreen mode. Any insight?

https://drive.google.com/open?id=0B1STlCrdBcafWkJycFBHUjFrOGM


    start_time=my_canvas_restudy.show()
    answered=False
    print answered
    letters=0
    resp=''
    startpoint = 32
    startwhile = self.time()
    while answered==False and (self.time() - startwhile < 10000):
        key, end_time = my_keyboard_restudy2.get_key()
        print 'resp', resp
        if key == 'backspace':
            print 'resp', resp
            if len(resp)>0:
                startpoint = startpoint-10
                my_canvas_restudy.rect(color = 'black', x=startpoint-5, y=0-10, w=30, h=30, fill =True)
                resp=resp[0:-1]
                my_canvas_restudy.show()
                print 'resp', resp
        elif key == 'return':
            answered = True
            print answered
        elif key <> None and key <> 'left' and key <> 'right' and key <> 'space' and key <> 'left shift' and key <> 'right shift' and len(resp) < 9:
            print 'here'
            my_canvas_restudy.text(key,x=startpoint,y=0, color='white')
            startpoint = startpoint +10 
            my_canvas_restudy.show()
            resp += key
            print 'resp', resp 
        elif key == 'space' and len(resp) < 9:
            my_canvas_restudy.text(" ",x=startpoint,y=0, color='white')
            startpoint = startpoint+10
            my_canvas_restudy.show()
            print 'resp', resp

thanks in advance!!
Allison

Comments

  • Hi Allison,

    It would be best if you upload the entire experiment, so that I can take a look. You can use the forum's attachment function. You say that the same script works differently in different parts of the experiment; that seems quite unlikely, so there's probably something else going on. And what operating system do you use?

    Cheers,
    Sebastiaan

  • Hi Sebastiaan,

    I've attached the experiment in full. Like I said before, it runs fine when I run in quick run mode, but will not allow capital characters when I run in the window or fullscreen. This happens during the ReStudy_2 inline script in the ReStudy loop, but works correctly later (e.g., in the Distractor_1 inline script in the DistractorLoop). I am using Mac OSX 10.10.5.

    best,
    Allison

Sign In or Register to comment.