[linux-audio-user] a live performance timer

Paul Winkler pw_lists at slinkp.com
Wed Oct 20 19:38:29 EDT 2004


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


More information about the linux-audio-user mailing list