[Tutor] I think I got a final version of a clock program, it is in this post.
Charles Gruschow, Jr.
gruschow2@hotmail.com
Wed, 21 Mar 2001 22:36:12 -0600
This is a multi-part message in MIME format.
------=_NextPart_000_00A2_01C0B257.5511C260
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I think I got a final version of a clock program, it is in this post.
Charles Gruschow
gruschow2@hotmail.com
from Tkinter import *
from time import *
from locale import *
class Clock(Frame):
def __init__(self, master, format=3D"Our local time is now %X"):
Frame.__init__(self, master)
self.time =3D localtime(time())
self.timeformat =3D format
self.display =3D Label(self, fg=3D"green", bg=3D"black",
text=3Dstrftime(self.timeformat, self.time))
self.display.pack(side=3DTOP, expand=3DYES, fill=3DBOTH)
self.updateDisplay()
def updateDisplay(self):
self.time =3D localtime(time())
self.display.configure(text=3Dstrftime(self.timeformat, =
self.time))
self.after(1000, self.updateDisplay)
class Uptime(Frame):
def __init__(self,master,format2=3D"Dune UpTime is %d weeks %d days =
%d:%d:%d"):
Frame.__init__(self,master)
self.time=3D(w,d,h1,m,s)
self.time1=3Dself.time[0]
self.time2=3Dself.time[1]
self.time3=3Dself.time[2]
self.time4=3Dself.time[3]
self.time5=3Dself.time[4]
self.timeformat=3Dformat2
self.display=3DLabel(self,fg=3D"green",bg=3D"black",
text=3Dformat(self.timeformat,self.time))
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)
self.updateDisplay()
def updateDisplay(self):
self.time5=3Dself.time5+1
if self.time5=3D=3D60:
self.time5=3D0
self.time4=3Dself.time4+1
if self.time4=3D=3D60:
self.time4=3D0
self.time3=3Dself.time3+1
if self.time3=3D=3D24:
self.time3=3D0
self.time2=3Dself.time2+1
if self.time2=3D=3D7:
self.time2=3D0
self.time1=3Dself.time1+1
=
self.time=3D(self.time1,self.time2,self.time3,self.time4,self.time5)
self.display.configure(text=3Dformat(self.timeformat,self.time))
self.after(1000,self.updateDisplay)
class Clock18(Frame):
def __init__(self,master,format2=3D"Time so far on 18 hr. planet is =
%d:%d:%d"):
Frame.__init__(self,master)
self.time=3D(h,m,s)
self.time1=3Dself.time[0]
self.time2=3Dself.time[1]
self.time3=3Dself.time[2]
if self.time1>18:
self.time1=3Dself.time1 % 18
self.timeformat=3Dformat2
self.display=3DLabel(self,fg=3D"green",bg=3D"black",
text=3Dformat(self.timeformat,self.time))
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)
self.updateDisplay()
def updateDisplay(self):
self.time3=3Dself.time3+1
if self.time3=3D=3D60:
self.time3=3D0
self.time2=3Dself.time2+1
if self.time2=3D=3D60:
self.time2=3D0
self.time1=3Dself.time1+1
if self.time1=3D=3D18:
self.time1=3D0
self.time=3D(self.time1,self.time2,self.time3)
self.display.configure(text=3Dformat(self.timeformat,self.time))
self.after(1000,self.updateDisplay)
class Clock21(Frame):
def __init__(self,master,format2=3D"Time so far on 21 hr. planet is =
%d:%d:%d"):
Frame.__init__(self,master)
self.time=3D(h,m,s)
self.time1=3Dself.time[0]
self.time2=3Dself.time[1]
self.time3=3Dself.time[2]
if self.time1>21:
self.time1=3Dself.time1 % 21
self.timeformat=3Dformat2
self.display=3DLabel(self,fg=3D"green",bg=3D"black",
text=3Dformat(self.timeformat,self.time))
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)
self.updateDisplay()
def updateDisplay(self):
self.time3=3Dself.time3+1
if self.time3=3D=3D60:
self.time3=3D0
self.time2=3Dself.time2+1
if self.time2=3D=3D60:
self.time2=3D0
self.time1=3Dself.time1+1
if self.time1=3D=3D21:
self.time1=3D0
self.time=3D(self.time1,self.time2,self.time3)
self.display.configure(text=3Dformat(self.timeformat,self.time))
self.after(1000,self.updateDisplay)
class Clock24(Frame):
def __init__(self,master,format2=3D"Time so far on 24 hr. planet is =
%d:%d:%d"):
Frame.__init__(self,master)
self.time=3D(h,m,s)
self.time1=3Dself.time[0]
self.time2=3Dself.time[1]
self.time3=3Dself.time[2]
if self.time1>24:
self.time1=3Dself.time1 % 24
self.timeformat=3Dformat2
self.display=3DLabel(self,fg=3D"green",bg=3D"black",
text=3Dformat(self.timeformat,self.time))
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)
self.updateDisplay()
def updateDisplay(self):
self.time3=3Dself.time3+1
if self.time3=3D=3D60:
self.time3=3D0
self.time2=3Dself.time2+1
if self.time2=3D=3D60:
self.time2=3D0
self.time1=3Dself.time1+1
if self.time1=3D=3D24:
self.time1=3D0
self.time=3D(self.time1,self.time2,self.time3)
self.display.configure(text=3Dformat(self.timeformat,self.time))
self.after(1000,self.updateDisplay)
class Clock28(Frame):
def __init__(self,master,format2=3D"Time so far on 28 hr. planet is =
%d:%d:%d"):
Frame.__init__(self,master)
self.time=3D(h,m,s)
self.time1=3Dself.time[0]
self.time2=3Dself.time[1]
self.time3=3Dself.time[2]
if self.time1>28:
self.time1=3Dself.time1 % 28
self.timeformat=3Dformat2
self.display=3DLabel(self,fg=3D"green",bg=3D"black",
text=3Dformat(self.timeformat,self.time))
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)
self.updateDisplay()
def updateDisplay(self):
self.time3=3Dself.time3+1
if self.time3=3D=3D60:
self.time3=3D0
self.time2=3Dself.time2+1
if self.time2=3D=3D60:
self.time2=3D0
self.time1=3Dself.time1+1
if self.time1=3D=3D28:
self.time1=3D0
self.time=3D(self.time1,self.time2,self.time3)
self.display.configure(text=3Dformat(self.timeformat,self.time))
self.after(1000,self.updateDisplay)
class Clock36(Frame):
def __init__(self,master,format2=3D"Time so far on 36 hr. planet is =
%d:%d:%d"):
Frame.__init__(self,master)
self.time=3D(h,m,s)
self.time1=3Dself.time[0]
self.time2=3Dself.time[1]
self.time3=3Dself.time[2]
if self.time1>36:
self.time1=3Dself.time1 % 36
self.timeformat=3Dformat2
self.display=3DLabel(self,fg=3D"green",bg=3D"black",
text=3Dformat(self.timeformat,self.time))
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)
self.updateDisplay()
def updateDisplay(self):
self.time3=3Dself.time3+1
if self.time3=3D=3D60:
self.time3=3D0
self.time2=3Dself.time2+1
if self.time2=3D=3D60:
self.time2=3D0
self.time1=3Dself.time1+1
if self.time1=3D=3D36:
self.time1=3D0
self.time=3D(self.time1,self.time2,self.time3)
self.display.configure(text=3Dformat(self.timeformat,self.time))
self.after(1000,self.updateDisplay)
if __name__ =3D=3D "__main__":
print "Dune MUD Time Giver"
print "by Charles Gruschow"
print "email: gruschow2@hotmail.com"
print
w=3Dinput("Number of uptime weeks (this will be w) ? ")
d=3Dinput("Number of uptime days (this will be d) ? ")
h=3Dinput("Number of uptime hours (this will be h) ? ")
m=3Dinput("Number of uptime minutes (this will be m) ? ")
s=3Dinput("Number of uptime seconds (this will be s) ? ")
s3=3D(w*7*24*3600)+(d*24*3600)+(h*3600)+(m*60)+s
print
print "Seconds uptime is: ",s3
s3=3D(1-0.00303674226326)*s3
print "Seconds uptime less 0.303674226326%: ",s3
print "That factor was since planet times lag behind uptime."
w3=3Dw
d3=3Dd
h3=3Dh
m3=3Dm
if s3>604800:
w3=3Dint(s3/604800)
d3=3Dw3*7
h3=3Dd3*24
m3=3Dh3*60
s3=3Ds3-(w3*604800)
if s3>86400:
d3=3Dint(s3/86400)
h3=3Dd3*24
m3=3Dh3*60
s3=3Ds3-(d3*86400)
if s3>3600:
h3=3Dint(s3/3600)
m3=3Dh3*60
s3=3Ds3-(h3*3600)
if s3>60:
m3=3Dint(s3/60)
s3=3Ds3-(m3*60)
w3=3Dint(w3)
d3=3Dint(d3)
h3=3Dint(h3)
m3=3Dint(m3)
s3=3Dint(s3)
print
print "Corrected: wks.: %d, dys.: %d, hrs.: %d, min.: %d, sec.: %d" =
% (w3,d3,h3,m3,s3)
print "These corrected values will show themselves most readily in =
the 24 hr. planets."
w=3Dint(abs(w))
d=3Dint(abs(d))
h1=3Dint(abs(h))
h=3Dh+(w*7*24)+(d*24)
h=3Dint(abs(h))
m=3Dint(abs(m))
s=3Dint(abs(s))
=20
=20
if s>60:
s1=3Ds
s=3Ds%60
m=3Dm+int(s1/60)
if m>60:
m1=3Dm
m=3Dm%60
h1=3Dh1+int(m1/60)
if h1>24:
h2=3Dh1
h1=3Dh1%24
d=3Dd+int(h2/24)
if d>7:
d1=3Dd
d=3Dd%7
w=3Dw+int(d1/7)
=20
tkroot =3D Tk()
tkroot.title("Dune MUD Time Giver")
labelx =3D Label(tkroot,fg=3D"red",text=3D"Dune MUD (based on works =
of Frank Herbert) Time Giver",font=3D("Times",14))
labelx.pack()
labelx =3D Label(tkroot,fg=3D"blue",text=3D"for info contact =
gruschow2@hotmail.com")
labelx.pack()
labelx =3D Label(tkroot)
labelx["height"] =3D 1
labelx.pack()
Clock(tkroot, "Our local time is now %X").pack(side=3DTOP)
Uptime(tkroot,"Dune UpTime is %d weeks %d days =
%d:%d:%d").pack(side=3DTOP,pady=3D5)
h=3Dh3
m=3Dm3
s=3Ds3
labelx =3D Label(tkroot)
labelx["height"] =3D 1
labelx.pack()
labelx =3D Label(tkroot,text=3D"Planets of Chapterhouse and =
Wallach")
labelx.pack()
Clock18(tkroot,"Time so far on 18 hr. planet is =
%d:%d:%d").pack(side=3DTOP)
labelx =3D Label(tkroot,text=3D"Planet of Salusa")
labelx.pack()
Clock21(tkroot,"Time so far on 21 hr. planet is =
%d:%d:%d").pack(side=3DTOP)
labelx =3D Label(tkroot,text=3D"Planets of Arrakis (Dune) and Ix")
labelx.pack()
Clock24(tkroot,"Time so far on 24 hr. planet is =
%d:%d:%d").pack(side=3DTOP)
labelx =3D Label(tkroot,text=3D"Planet of Geidi Prime")
labelx.pack()
Clock28(tkroot,"Time so far on 28 hr. planet is =
%d:%d:%d").pack(side=3DTOP)
labelx =3D Label(tkroot,text=3D"Planet of Caladan")
labelx.pack()
Clock36(tkroot,"Time so far on 36 hr. planet is =
%d:%d:%d").pack(side=3DTOP)
labelx =3D Label(tkroot)
labelx["height"] =3D 1
labelx.pack()
labelx =3D Label(tkroot,fg=3D"blue",text=3D"Due to electromagnetic =
properties of the planet Tleilax,")
labelx.pack()
labelx =3D Label(tkroot,fg=3D"blue",text=3D"it isn't necessary to =
calculate time for there.")
labelx.pack()
labelx =3D Label(tkroot,fg=3D"blue",text=3D"Also, the times for the =
planets can only be approximated.")
labelx.pack()
tkroot.mainloop()
=20
=20
=20
------=_NextPart_000_00A2_01C0B257.5511C260
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3019.2500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><FONT size=3D2>
<P>I think I got a final version of a clock program, it is in this=20
post.</P></FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Charles Gruschow</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"mailto:gruschow2@hotmail.com">gruschow2@hotmail.com</A></FONT></D=
IV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>from Tkinter import *<BR>from time =
import *<BR>from=20
locale import *</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><BR>class Clock(Frame):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def __init__(self, =
master,=20
format=3D"Our local time is now %X"):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
Frame.__init__(self, master)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time =3D =
localtime(time())<BR> =20
self.timeformat =3D format<BR> =
self.display =3D Label(self, fg=3D"green",=20
bg=3D"black",<BR> &n=
bsp; =20
text=3Dstrftime(self.timeformat,=20
self.time))<BR> =20
self.display.pack(side=3DTOP, expand=3DYES,=20
fill=3DBOTH)<BR> =20
self.updateDisplay()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
updateDisplay(self):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time =3D =
localtime(time())<BR> =20
self.display.configure(text=3Dstrftime(self.timeformat,=20
self.time))<BR> =
self.after(1000,=20
self.updateDisplay)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>class Uptime(Frame):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
__init__(self,master,format2=3D"Dune UpTime is %d weeks %d days=20
%d:%d:%d"):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
Frame.__init__(self,master)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(w,d,h1,m,s)<BR> =20
self.time1=3Dself.time[0]<BR> =20
self.time2=3Dself.time[1]<BR> =20
self.time3=3Dself.time[2]<BR> =20
self.time4=3Dself.time[3]<BR> =20
self.time5=3Dself.time[4]</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.timeformat=3Dformat2<BR> =20
self.display=3DLabel(self,fg=3D"green",bg=3D"black",<BR>  =
; =
=20
text=3Dformat(self.timeformat,self.time))<BR> &nbs=
p; =20
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)<BR> &nb=
sp; =20
self.updateDisplay()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
updateDisplay(self):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time5=3Dself.time5+1</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time5=3D=3D60:<BR> &n=
bsp; =20
self.time5=3D0<BR> &=
nbsp; =20
self.time4=3Dself.time4+1<BR> =
if=20
self.time4=3D=3D60:<BR> &n=
bsp; =20
self.time4=3D0<BR> &=
nbsp; =20
self.time3=3Dself.time3+1<BR> =
if=20
self.time3=3D=3D24:<BR> &n=
bsp; =20
self.time3=3D0<BR> &=
nbsp; =20
self.time2=3Dself.time2+1<BR> =
if=20
self.time2=3D=3D7:<BR> &nb=
sp; =20
self.time2=3D0<BR> &=
nbsp; =20
self.time1=3Dself.time1+1</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(self.time1,self.time2,self.time3,self.time4,self.time5)<BR>&=
nbsp; =20
self.display.configure(text=3Dformat(self.timeformat,self.time))<BR> =
; =20
self.after(1000,self.updateDisplay)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>class Clock18(Frame):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
__init__(self,master,format2=3D"Time so far on 18 hr. planet is=20
%d:%d:%d"):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
Frame.__init__(self,master)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(h,m,s)<BR> =20
self.time1=3Dself.time[0]<BR> =20
self.time2=3Dself.time[1]<BR> =20
self.time3=3Dself.time[2]</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time1>18:<BR> &nbs=
p; =20
self.time1=3Dself.time1 % 18</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.timeformat=3Dformat2<BR> =20
self.display=3DLabel(self,fg=3D"green",bg=3D"black",<BR>  =
; =
=20
text=3Dformat(self.timeformat,self.time))<BR> &nbs=
p; =20
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)<BR> &nb=
sp; =20
self.updateDisplay()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
updateDisplay(self):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time3=3Dself.time3+1</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time3=3D=3D60:<BR> &n=
bsp; =20
self.time3=3D0<BR> &=
nbsp; =20
self.time2=3Dself.time2+1<BR> =
if=20
self.time2=3D=3D60:<BR> &n=
bsp; =20
self.time2=3D0<BR> &=
nbsp; =20
self.time1=3Dself.time1+1<BR> =
if=20
self.time1=3D=3D18:<BR> &n=
bsp; =20
self.time1=3D0</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(self.time1,self.time2,self.time3)<BR>  =
; =20
self.display.configure(text=3Dformat(self.timeformat,self.time))<BR> =
; =20
self.after(1000,self.updateDisplay)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>class Clock21(Frame):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
__init__(self,master,format2=3D"Time so far on 21 hr. planet is=20
%d:%d:%d"):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
Frame.__init__(self,master)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(h,m,s)<BR> =20
self.time1=3Dself.time[0]<BR> =20
self.time2=3Dself.time[1]<BR> =20
self.time3=3Dself.time[2]</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time1>21:<BR> &nbs=
p; =20
self.time1=3Dself.time1 % 21</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.timeformat=3Dformat2<BR> =20
self.display=3DLabel(self,fg=3D"green",bg=3D"black",<BR>  =
; =
=20
text=3Dformat(self.timeformat,self.time))<BR> &nbs=
p; =20
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)<BR> &nb=
sp; =20
self.updateDisplay()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
updateDisplay(self):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time3=3Dself.time3+1</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time3=3D=3D60:<BR> &n=
bsp; =20
self.time3=3D0<BR> &=
nbsp; =20
self.time2=3Dself.time2+1<BR> =
if=20
self.time2=3D=3D60:<BR> &n=
bsp; =20
self.time2=3D0<BR> &=
nbsp; =20
self.time1=3Dself.time1+1<BR> =
if=20
self.time1=3D=3D21:<BR> &n=
bsp; =20
self.time1=3D0</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(self.time1,self.time2,self.time3)<BR>  =
; =20
self.display.configure(text=3Dformat(self.timeformat,self.time))<BR> =
; =20
self.after(1000,self.updateDisplay)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>class Clock24(Frame):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
__init__(self,master,format2=3D"Time so far on 24 hr. planet is=20
%d:%d:%d"):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
Frame.__init__(self,master)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(h,m,s)<BR> =20
self.time1=3Dself.time[0]<BR> =20
self.time2=3Dself.time[1]<BR> =20
self.time3=3Dself.time[2]</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time1>24:<BR> &nbs=
p; =20
self.time1=3Dself.time1 % 24</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.timeformat=3Dformat2<BR> =20
self.display=3DLabel(self,fg=3D"green",bg=3D"black",<BR>  =
; =
=20
text=3Dformat(self.timeformat,self.time))<BR> &nbs=
p; =20
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)<BR> &nb=
sp; =20
self.updateDisplay()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
updateDisplay(self):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time3=3Dself.time3+1</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time3=3D=3D60:<BR> &n=
bsp; =20
self.time3=3D0<BR> &=
nbsp; =20
self.time2=3Dself.time2+1<BR> =
if=20
self.time2=3D=3D60:<BR> &n=
bsp; =20
self.time2=3D0<BR> &=
nbsp; =20
self.time1=3Dself.time1+1<BR> =
if=20
self.time1=3D=3D24:<BR> &n=
bsp; =20
self.time1=3D0</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(self.time1,self.time2,self.time3)<BR>  =
; =20
self.display.configure(text=3Dformat(self.timeformat,self.time))<BR> =
; =20
self.after(1000,self.updateDisplay)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>class Clock28(Frame):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
__init__(self,master,format2=3D"Time so far on 28 hr. planet is=20
%d:%d:%d"):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
Frame.__init__(self,master)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(h,m,s)<BR> =20
self.time1=3Dself.time[0]<BR> =20
self.time2=3Dself.time[1]<BR> =20
self.time3=3Dself.time[2]</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time1>28:<BR> &nbs=
p; =20
self.time1=3Dself.time1 % 28</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.timeformat=3Dformat2<BR> =20
self.display=3DLabel(self,fg=3D"green",bg=3D"black",<BR>  =
; =
=20
text=3Dformat(self.timeformat,self.time))<BR> &nbs=
p; =20
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)<BR> &nb=
sp; =20
self.updateDisplay()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
updateDisplay(self):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time3=3Dself.time3+1</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time3=3D=3D60:<BR> &n=
bsp; =20
self.time3=3D0<BR> &=
nbsp; =20
self.time2=3Dself.time2+1<BR> =
if=20
self.time2=3D=3D60:<BR> &n=
bsp; =20
self.time2=3D0<BR> &=
nbsp; =20
self.time1=3Dself.time1+1<BR> =
if=20
self.time1=3D=3D28:<BR> &n=
bsp; =20
self.time1=3D0</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(self.time1,self.time2,self.time3)<BR>  =
; =20
self.display.configure(text=3Dformat(self.timeformat,self.time))<BR> =
; =20
self.after(1000,self.updateDisplay)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>class Clock36(Frame):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
__init__(self,master,format2=3D"Time so far on 36 hr. planet is=20
%d:%d:%d"):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
Frame.__init__(self,master)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(h,m,s)<BR> =20
self.time1=3Dself.time[0]<BR> =20
self.time2=3Dself.time[1]<BR> =20
self.time3=3Dself.time[2]</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time1>36:<BR> &nbs=
p; =20
self.time1=3Dself.time1 % 36</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.timeformat=3Dformat2<BR> =20
self.display=3DLabel(self,fg=3D"green",bg=3D"black",<BR>  =
; =
=20
text=3Dformat(self.timeformat,self.time))<BR> &nbs=
p; =20
self.display.pack(side=3DTOP,expand=3DYES,fill=3DBOTH)<BR> &nb=
sp; =20
self.updateDisplay()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> def=20
updateDisplay(self):</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time3=3Dself.time3+1</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> if=20
self.time3=3D=3D60:<BR> &n=
bsp; =20
self.time3=3D0<BR> &=
nbsp; =20
self.time2=3Dself.time2+1<BR> =
if=20
self.time2=3D=3D60:<BR> &n=
bsp; =20
self.time2=3D0<BR> &=
nbsp; =20
self.time1=3Dself.time1+1<BR> =
if=20
self.time1=3D=3D36:<BR> &n=
bsp; =20
self.time1=3D0</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
self.time=3D(self.time1,self.time2,self.time3)<BR>  =
; =20
self.display.configure(text=3Dformat(self.timeformat,self.time))<BR> =
; =20
self.after(1000,self.updateDisplay)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>if __name__ =3D=3D =
"__main__":</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><BR> print "Dune MUD =
Time=20
Giver"<BR> print "by Charles =
Gruschow"<BR> =20
print "email: <A=20
href=3D"mailto:gruschow2@hotmail.com">gruschow2@hotmail.com</A>"<BR> =
; =20
print<BR> w=3Dinput("Number of uptime weeks (this will =
be w) ?=20
")<BR> d=3Dinput("Number of uptime days (this will be =
d) ?=20
")<BR> h=3Dinput("Number of uptime hours (this will be =
h) ?=20
")<BR> m=3Dinput("Number of uptime minutes (this will =
be m) ?=20
")<BR> s=3Dinput("Number of uptime seconds (this will =
be s) ?=20
")<BR> =20
s3=3D(w*7*24*3600)+(d*24*3600)+(h*3600)+(m*60)+s<BR> =20
print<BR> print "Seconds uptime is: =
",s3<BR> =20
s3=3D(1-0.00303674226326)*s3<BR> print "Seconds uptime =
less=20
0.303674226326%: ",s3<BR> print "That factor was since =
planet=20
times lag behind uptime."<BR> =
w3=3Dw<BR> =20
d3=3Dd<BR> h3=3Dh<BR> =
m3=3Dm<BR> =20
if s3>604800:<BR> =20
w3=3Dint(s3/604800)<BR> =20
d3=3Dw3*7<BR> =20
h3=3Dd3*24<BR> =20
m3=3Dh3*60<BR> =20
s3=3Ds3-(w3*604800)<BR> if=20
s3>86400:<BR> =20
d3=3Dint(s3/86400)<BR> =20
h3=3Dd3*24<BR> =20
m3=3Dh3*60<BR> =20
s3=3Ds3-(d3*86400)<BR> if=20
s3>3600:<BR> =20
h3=3Dint(s3/3600)<BR> =20
m3=3Dh3*60<BR> =20
s3=3Ds3-(h3*3600)<BR> if=20
s3>60:<BR> =20
m3=3Dint(s3/60)<BR> =20
s3=3Ds3-(m3*60)<BR> w3=3Dint(w3)<BR> =
d3=3Dint(d3)<BR> h3=3Dint(h3)<BR> =20
m3=3Dint(m3)<BR> s3=3Dint(s3)<BR> =20
print<BR> print "Corrected: wks.: %d, dys.: %d, hrs.: =
%d,=20
min.: %d, sec.: %d" % (w3,d3,h3,m3,s3)<BR> print =
"These=20
corrected values will show themselves most readily in the 24 hr.=20
planets."<BR> w=3Dint(abs(w))<BR> =20
d=3Dint(abs(d))<BR> =
h1=3Dint(abs(h))<BR> =20
h=3Dh+(w*7*24)+(d*24)<BR> =
h=3Dint(abs(h))<BR> =20
m=3Dint(abs(m))<BR> =
s=3Dint(abs(s))<BR> =20
<BR> <BR> if=20
s>60:<BR> =20
s1=3Ds<BR> =20
s=3Ds%60<BR> =20
m=3Dm+int(s1/60)<BR> if=20
m>60:<BR> =20
m1=3Dm<BR> =20
m=3Dm%60<BR> =20
h1=3Dh1+int(m1/60)<BR> if=20
h1>24:<BR> =20
h2=3Dh1<BR> =20
h1=3Dh1%24<BR> =20
d=3Dd+int(h2/24)<BR> if=20
d>7:<BR> =20
d1=3Dd<BR> =20
d=3Dd%7<BR> =20
w=3Dw+int(d1/7)<BR> =20
<BR> tkroot =3D Tk()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> tkroot.title("Dune =
MUD Time=20
Giver")</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> labelx =3D=20
Label(tkroot,fg=3D"red",text=3D"Dune MUD (based on works of Frank =
Herbert) Time=20
Giver",font=3D("Times",14))<BR> =20
labelx.pack()<BR> labelx =3D =
Label(tkroot,fg=3D"blue",text=3D"for=20
info contact <A=20
href=3D'mailto:gruschow2@hotmail.com")'>gruschow2@hotmail.com")</A><BR>&n=
bsp; =20
labelx.pack()<BR> labelx =3D =
Label(tkroot)<BR> =20
labelx["height"] =3D 1<BR> labelx.pack()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> Clock(tkroot, "Our =
local time is=20
now %X").pack(side=3DTOP)<BR> Uptime(tkroot,"Dune =
UpTime is %d=20
weeks %d days %d:%d:%d").pack(side=3DTOP,pady=3D5)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =
h=3Dh3<BR> =20
m=3Dm3<BR> s=3Ds3</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> labelx =3D=20
Label(tkroot)<BR> labelx["height"] =3D =
1<BR> =20
labelx.pack()<BR> labelx =3D =
Label(tkroot,text=3D"Planets of=20
Chapterhouse and Wallach")<BR> =
labelx.pack()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> Clock18(tkroot,"Time =
so far on=20
18 hr. planet is %d:%d:%d").pack(side=3DTOP)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> labelx =3D=20
Label(tkroot,text=3D"Planet of Salusa")<BR> =20
labelx.pack()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> Clock21(tkroot,"Time =
so far on=20
21 hr. planet is %d:%d:%d").pack(side=3DTOP)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> labelx =3D=20
Label(tkroot,text=3D"Planets of Arrakis (Dune) and =
Ix")<BR> =20
labelx.pack()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> Clock24(tkroot,"Time =
so far on=20
24 hr. planet is %d:%d:%d").pack(side=3DTOP)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> labelx =3D=20
Label(tkroot,text=3D"Planet of Geidi Prime")<BR> =20
labelx.pack()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> Clock28(tkroot,"Time =
so far on=20
28 hr. planet is %d:%d:%d").pack(side=3DTOP)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> labelx =3D=20
Label(tkroot,text=3D"Planet of Caladan")<BR> =20
labelx.pack()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> Clock36(tkroot,"Time =
so far on=20
36 hr. planet is %d:%d:%d").pack(side=3DTOP)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> labelx =3D=20
Label(tkroot)<BR> labelx["height"] =3D =
1<BR> =20
labelx.pack()<BR> labelx =3D =
Label(tkroot,fg=3D"blue",text=3D"Due to=20
electromagnetic properties of the planet =
Tleilax,")<BR> =20
labelx.pack()<BR> labelx =3D =
Label(tkroot,fg=3D"blue",text=3D"it=20
isn't necessary to calculate time for there.")<BR> =20
labelx.pack()<BR> labelx =3D =
Label(tkroot,fg=3D"blue",text=3D"Also,=20
the times for the planets can only be =
approximated.")<BR> =20
labelx.pack()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =
tkroot.mainloop()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial=20
size=3D2> <BR> =
=20
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
<BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_00A2_01C0B257.5511C260--