From: Bruce S. <Bru...@nc...> - 2011-11-02 18:22:45
|
I'm not sure I follow all the issues here, but I do want to emphasize as James Mueller points out that rate is NOT an equivalent of sleep. Its purpose is to put an upper bound on the rate at which an animation runs, so that on a very fast computer your animation doesn't run so fast you can't see it. Bruce Sherwood On Wed, Nov 2, 2011 at 7:20 AM, Jerzy Karczmarczuk <jer...@un...> wrote: > 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 > > > ------------------------------------------------------------------------------ > RSA® Conference 2012 > Save $700 by Nov 18 > Register now! > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |