[Tutor] please respond to my last ?, I have desperately been trying to figure this out, I want to make a digital clock

Remco Gerlich scarblac@pino.selwerd.nl
Wed, 7 Mar 2001 10:46:21 +0100


On Wed, Mar 07, 2001 at 12:46:23AM -0600, Charles Gruschow, Jr. wrote:
> please respond to my last ?, I have desperately been trying to figure this
> out, I want to make a digital clock
> 
> I would like to use labels amd widgets and Tkinter.

A digital clock? So you only show the hours, minutes etc in text, you don't
have to draw a clock?

You're going to need a simple Tkinter frame and maybe one label in it 
(saying: 'time: 10:40:27') or maybe a few for seperate hours, minutes,
seconds.

The introduction to Tkinter is at
http://www.secretlabs.com/library/tkinter/introduction/hello-again.htm

Look at the second Hello World example and at the docs for Labels, and try
to put them together into something that displays some text.

Next, you can get the time with something like this:
import time
year, month, day, hour, minutes, seconds = time.localtime(time.time())[:6]

And put together something to display from that.

Then, all you need to do is call that again after a second or so. See the
'Alarm' documentation in the Tkinter docs or time.sleep().

This should get you underway...

-- 
Remco Gerlich