Howdy, Stranger!

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

Supported by

python code does not work anymore with OpenSesame 3.2

Dear folks,

i have updated OpenSesame to 3.2 and now my code that used to work, does not work anymore :/

This is the code

def TRIALhalf1(): #1st part of a trial
    if fam_hand[1] == 'L' :
        InstL.show()
        key, time=leer.get_key()
    if fam_hand[1] == 'R' :
        InstR.show()
        key, time=leer.get_key()
    for i in range(5):#press SPACE and keep it pressed
        t0 = red[i].show() #fomula 1 timer goes on
        #if SPACE is lifted start again
        while True:
            for event in pygame.event.get():
                if event.type == KEYUP:
                    TRIALhalf1()
                    break
            if clock.time()-t0 >= 1000:
                break

What should it do?
Show an instruction to press the SPACE key.
Show a counter that goes down from 5 to 0 in steps of 1sec
However, if SPACE is lifted to early, start from the beginning again.

Comments

  • [solved] sorry for bothering anyone.
    The new code is much easier, but it's sad that the old code does not work anymore.

    def TRIALhalf1(): #1st part of a trial
        keyR = None
        if fam_hand[1] == 'L' :
            InstL.show()
            key, time=leer.get_key()
        if fam_hand[1] == 'R' :
            InstR.show()
            key, time=leer.get_key()
        for i in range(5):#press SPACE and keep it pressed
            t0 = red[i].show() #fomula 1 timer goes on
            #if SPACE is lifted start again
            keyR, timeR = leer.get_key_release(timeout=995)
            if keyR != None:
                TRIALhalf1()
                break
    
Sign In or Register to comment.