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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| # -*- coding: cp1252 -*-
from Tkinter import*
from math import*
from time import gmtime, strftime
from random import randrange
import threading
def seconde():
global tex6
threading.Timer(1.0, seconde).start()
tex6.config(text=strftime("%a, %d %b %Y\n%H:%M:%S", gmtime()))
def affichage():
dir1=raw_input('entrer valeur de direction du vent:')
if( ((dir1>=0) & (dir1<15)) | ((dir1>225) & (dir1<241))):
tex2.config(text='NORD')
if((dir1<46) & (dir1>15)):
tex2.config(text='NORD-EST')
if((dir1<76) & (dir1>45)):
tex2.config(text='EST')
if((dir1<106) & (dir1>75)):
tex2.config(text='SUD-EST')
if((dir1<136) & (dir1>105)):
tex2.config(text='SUD')
if((dir1<166) & (dir1>135)):
tex2.config(text='SUD-OUEST')
if((dir1<196) & (dir1>165)):
tex2.config(text='OUEST')
if((dir1<226) & (dir1>195)):
tex2.config(text='NORD-OUEST')
fen = Tk()
fen.title("Fenêtre Principale Station Météo")
fen.geometry("1280x1024")
f=Frame(fen,bd=2,relief=SOLID)
f.pack()
tex2=Label(f,text='ok',font=('LCDmono ultra',20),fg='blue')
tex6=Label(f,text=strftime("%a, %d %b %Y \n %H:%M:%S", gmtime()),font=('Chiller',15))
b5=Button(f, text='Quitter',font=('Chiller',15),fg='red',width=11,height=1, command = fen.quit)
b6=Button(f, text='Affichage',font=('Chiller',15),fg='red',width=11,height=1, command = affichage())
b6.pack()
b5.pack()
tex2.pack()
tex6.pack()
seconde()
fen.mainloop()
fen.destroy() |
Partager