psychopy.org | Reference | Downloads | Github

Time stamp animation

Hello,
i would to animate an object and would like to display it each refresh rate of the screen.
My code is :

timing=0
        for frameN in range (timeStim*60):
            x=self.queueGui.get_nowait() 
            y=0
            print(timing)
            self.stimU.draw()
            self.stimU.pos =(x,y)
            timing=self.windo.flip()

‘timeStim’ is in second.
My increment of my variable ‘timing’ is not related to my refresh rate (0.0016s) and i dont know why!
Any idea?
Thanks!

Your code is difficult to read, because we know little of the context. The code seems to be part of a custom class definition and we have for example no idea, what queueGui.get_nowait() does. That being said, I don’t think that you need the print function to check the timing. Use Psychopy’s logging module and the window method psychopy.visual.Window.logOnFlip. Or record your frame intervals.
These options distort your timing less than the print statement, which itself takes considerable time if you call it on every frame.

Thanks @LukasPsy,
i would like to animate an objet in psychopy (stimU) with data recorded in real time by another soft.
I understand now that maybe i have not see the real problem. My data come from a lifo queue (queueGui) feed by another soft in real time (140Hz) , i can set this frequency. However i don’t know how to “synchronise” data of the other soft with the displaying stimuli of psychopy (stimU) in order to avoid lag between data recorded and stimU object.
I thought about that but no idea for the moment…
Thanks!