From: Jerzy K. <jer...@un...> - 2011-11-02 13:21:06
|
James Mueller : > One point is that rate and sleep have different purposes. > > rate is trying to make sure that each iteration of the loop takes a > time slp. So to get the same effect from sleep, you would need to > call time.sleep(slp-delta), where delta is the amount of time taken by > the instructions in the rest of the loop. > OK, but doesn't matter. Some simple instructions in Python don't take much time. (And if the rendering thread is autonomous, it doesn't waste the time of the main process. If in my cited program you eliminate all waiting, the process terminates before you are able to see any movement. Who will need an incredibly fine tuning while programming in Python? You may make some variants, if you wish, e.g. introduce into a loop a timing block which measures the time lapse /since its last call/, and wait until your "rate" condition is fulfilled. Clumsy... == The problem is the thread safety. The sleep() call *is* a replacement for rate(), that's all I wanted to say. Thank you for your reaction. Best regards. Jerzy Karczmarczuk |