Countdown to Chrifsmas

This is what happens when you have a Sun Ray photo frame in your kitchen and a few minutes to spare:


27 lines of wish:

#!/usr/bin/wish

message .message -textvariable countdown -width 800 -font {-family times -size 24}
pack .message
set xmas [clock scan "25 dec 2007" ]

proc hours_mins_secs { total } {
	set secs [expr $total % 60 ]
	set mins [expr ($total/60) % 60 ]
	set hours [expr ($total/3600) ]
	return "$hours hours, $mins minutes, $secs seconds."
}

proc doit {} {
	global xmas
	global countdown
	set t [expr $xmas - [clock seconds]]
	if { $t > 0 } {
		set countdown  "Time Until Chrifsmas:\\n[hours_mins_secs $t]"
	} else {
		set countdown  [clock format [clock seconds]]
	}
	after 1000 doit
}

doit
tkwait  window .message

Lots of things could be better but it keeps the kids happy.

Comments:

So I guess you could say that's your Christmas wish?

Posted by Chad Mynhier on December 24, 2007 at 04:55 AM GMT #

That is terrible! It made me laugh though.

Thanks

Posted by Chris Gerhard on December 24, 2007 at 04:57 AM GMT #

Merry Christmas to you,your friends and your family.

Posted by michael on December 24, 2007 at 08:55 PM GMT #

Post a Comment:
Comments are closed for this entry.
About

This is the old blog of Chris Gerhard. It has mostly moved to http://chrisgerhard.wordpress.com

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today