C simple bibliotèque time time.asctime()[10:20]
ex :
from Tkinter import *
from random import randrange
import time
cro=0
class x :
def __init__ (self) :
self._1()
def _1 (self) :
global cro
cro=0
but2.configure(text='non',command=None)
but1.configure(text='oui',command=self._0)
but.configure(text='oui',command=self._2)
but3.configure(text='oui',command=self._3)
self.x=1
def _0 (self) :
but1.configure(text='non',command=None)
but2.configure(text='oui',command=self._1)
but.configure(text='oui',command=self._2)
but3.configure(text='oui',command=self._3)
self.x=0
def _2 (self) :
global cro
cro=0
but.configure(text='non',command=None)
but1.configure(text='oui',command=self._0)
but2.configure(text='oui',command=self._1)
but3.configure(text='oui',command=self._3)
self.x=2
def _3 (self) :
self.x=3
cro=0
but3.configure(text='non',command=None)
but1.configure(text='oui',command=self._0)
but2.configure(text='oui',command=self._1)
but.configure(text='oui',command=self._2)
def print_ (self) :
return self.x
def start ():
global cro
if x_.print_()==1:
fen.title(chr(randrange(255))+chr(randrange(255))+chr(randrange(255))+chr(randrange(255))+chr(randrange(255))+chr(randrange(255))+chr(randrange(255))+chr(randrange(255)))
elif x_.print_()==0:
cros=cro
crom=0
croh=0
croj=0
cro += 0.20
while 1:
if cros >=60:
cros -= 60
crom+=1
else :
break
while 1:
if crom >=60:
crom -= 60
croh+=1
else :
break
while 1:
if croh >=24:
croh -= 24
croj+=1
else :
break
fen.title('%sj%sh%sm%ss'%(croj,croh,crom,cros))
elif x_.print_()==2:
fen.title(time.asctime()[10:20])
elif x_.print_()==3:
fen.title('')
fen.bell()
fen.after(200,start)
fen =Tk()
#################
Label(fen,text='voulez vous demarer la montre ?').grid(row =1,column =1)
Label(fen,text='voulez vous demarer le chrono ?').grid(row =2,column =1)
Label(fen,text='voulez vous metre n\'importe quoi ?').grid(row =3,column =1)
Label(fen,text='voulez vous fair clignoter ?').grid(row =4,column =1)
but=Button(fen,text='oui')
but.grid(row =1,column =2)
but1=Button(fen,text='oui')
but1.grid(row =2,column =2)
but2=Button(fen,text='oui')
but2.grid(row =3,column =2)
but3=Button(fen,text='oui')
but3.grid(row =4,column =2)
x_=x()
start()
##################
fen.mainloop()
|