![]() |
|
|
|
#1
|
|||
|
|||
|
But with waitAny task move to next trial after the first mouse click. However, I want the task to remain same for 5s in spite of mouse click.
|
|
#2
|
|||
|
|||
|
The following code waits for a signal sent after 5 seconds or a mouse left button press. The code will loop and count the mouse clicks until the signal event occurs:
Code:
import viz
import viztask
import vizact
viz.go()
viz.addChild('dojo.osgb')
s = viztask.Signal()
waitMouse = viztask.waitMouseDown(viz.MOUSEBUTTON_LEFT)
waitSignal = s.wait()
def mouseTask():
mouseCounter = 0
vizact.ontimer2(5,0,s.send)
while True:
d = yield viztask.waitAny([waitMouse,waitSignal])
if d.condition == waitSignal:
break
else:
mouseCounter +=1
print mouseCounter
viztask.schedule( mouseTask() )
|
|
#3
|
|||
|
|||
|
Thanks a lot
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|