Stopwatch - pause counter

Morten Klim klim8d at gmail.com
Tue Jul 19 06:41:38 EDT 2011


Hello everyone!
I've started developing a little application for one of my friends,
which he will use at work to measure his hours working + the time he
has breaks. I wanna do this in python cause, I just started with this
language and wanna get more fimiliar with it. Sometimes though, it's a
bit of a struggle.

I found a nice stopwatch using tkinter, and I've modified it a bit to
my needs. The only thing I'm missing now is he wan't a pause counter,
for how long the pause button has been pushed.
An example:
I've worked for 2 hours, and wanna go for a break, I push the pause
button.
The pause counter then starts ticking, until the start button is
pressed again. So I have both a counter for working hours and pause
hours. If the pause button is pressed again, the current time he has
kept his break can't be reset, so it has to add the new time it to the
current.
I hope that made sense.

Here is my code: http://pastebin.com/T8FkMusS

The variables at __init__
self._pausestart = 0.0
self._elapsedpause = 0.0
and the method _updatepause are a attempt to make this work.

Regards,
Morten



More information about the Python-list mailing list