[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] Figuring out idle time



This is probably a remedial question, but I'm at kind of a loss as how
to do it right now.  I have an app in which I'd like to build in a
screensaver function.  After a given amount of idle time I'd like to
trigger the screensaver and exit it when an event is detected.  The
problem I'm having I believe is mostly related to the fact that I'm
using the event queue to check for key presses and thus I'm not sure how
to keep track of idle time in the main while loop.  The way I'm guessing
things would work would be to setup a timer of sorts (pygame.time ?),
then inside my main while loop have another while loop that checks for
either <= or >= to a configured interval and executes either the main
app function or the screensaver function depending upon that value.  In
the main app function I would then need to reset the timer value to 0
every time and input event is received.  The problem I seem to be
encountering is that when using the event queue the loop is only
completed when an event is received thus I can't monitor idle time.
This probably isn't difficult to solve, I'm just feeling especially
inept today :)  Any thoughts or snippets of code that might point me in
the right direction would be appreciated.  Thanks Much

Robert
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org