I have a loop as following ; start = time.time() end = time.time() - start while(end<N): data1 = self.chan1.getWaveform() end = time.time() - start timer.tick(10) #FPS screen.fill((255,255,255) if white else(0,0,0)) white = not white pygame.display.update() for i in range(self.size): end = time.time() - start f.write("%3.8f\t%f\n"%(end,data1[i]))
Roughly speaking, this loop displays something at 10 frames per second and writes data1 to a file with timestamps. At first loop data1 is grabbed but to grab the second value (second loop) it needs to wait for timer.tick to complete. When I change FPS value [timer.tick()], capturing period (time interval between loops) of data1 also changes. What I need is to run ; timer.tick(10) #FPS screen.fill((255,255,255) if white else(0,0,0)) white = not white pygame.display.update() for N seconds but this shouldn't effect the interval between loops thus I will be able to continuously grab data while displaying something at X fps. What would be an effective workaround for this situation ? -- http://mail.python.org/mailman/listinfo/python-list