예제 #1
0
파일: state.py 프로젝트: beegica/smileDocs
    def print_periodic():
        print "PERIODIC!"

    exp = Experiment()

    #with UntilDone():
    #    Wait(5.0)
    with Meanwhile():
        with Loop():
            Wait(5.0)
            Func(print_periodic)

    Debug(width=exp.screen.width, height=exp.screen.height)

    exp.bar = False
    with Parallel():
        with Serial():
            Wait(2.0)
            Func(lambda: None)  # force variable assignment to wait until correct time
            exp.bar = True
            Wait(2.0)
            Func(lambda: None)  # force variable assignment to wait until correct time
            exp.bar = False
            Wait(1.0)
        When(exp.bar, Debug(name="when test"))
        with While(exp.bar):
            with Loop():
                Wait(0.2)
                Debug(name="while test")
        with Loop(blocking=False):