Re: [linux-audio-user] a live performance timer

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-user] a live performance timer
From: Paul Winkler (pw_lists_AT_slinkp.com)
Date: Thu Oct 21 2004 - 02:38:29 EEST


On Wed, Oct 20, 2004 at 03:45:51PM +0100, Dave Griffiths wrote:
> cheers! :) development by mailing list...
>
> version 1.1:
>
> --->8---
>
> #! /usr/bin/env python
> from Tkinter import *
> from time import *
>
> class clock:
> def __init__(self,master):
> self.starttime=0
> self.widget=Button(master,text="
> 0:00",font=("Courier",50,"bold"),relief=FLAT,command=self.reset)
> self.widget.pack()
>
> def idle(self):
> thistime = int(time()-self.starttime)
> self.widget.config(text="%2d:%02d" % (thistime / 60, thistime % 60))

There's a builtin for that last expression :-)
ie:
                 self.widget.config(text="%2d:%02d" % divmod(thistime, 60))

-- 

Paul Winkler http://www.slinkp.com


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Thu Oct 21 2004 - 02:43:25 EEST