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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
import os
import csv
import tkinter as Tk
import PIL
class Identification (Tk.Tk) :
def __init__(self):
Tk.Tk.__init__(self)
self.titre()
self.iconbitmap("roue.ico")
self.creer_canvas()
self.User()
self.Install()
def titre(self):
self.titre = Tk.Label(self, text = "SERVICE SIG TOPOGRAPHIE")
self.titre.grid(row = 0)
def creer_canvas(self):
self.can =Tk.Canvas(self, width =350, height =150)
self.img = Tk.PhotoImage(file ="Sdeeg.gif")
self.can.create_image(175, 80, image =self.img)
self.can.grid(row = 1 , padx = 10 , pady = 10)
def User(self):
#Nom de l'odinateur
name = os.path.basename(os.environ['USERPROFILE'])
#Connexion au fichier des droits d'urtilisateur
#Création de liste pour connaitre comparer le nom et les droits d'acces
Connexion = r"Nom_Ordi.csv"
file = open(Connexion)
fichierCSV = csv.reader(file)
NomOrdi = []
User = []
for ligne in fichierCSV:
Ordi = ligne[0]
Nom = ligne[1]
NomOrdi.append(Ordi)
User.append(Nom)
if name not in NomOrdi :
info = ("Acces refusé")
else:
NumeroIndexUser = NomOrdi.index(name)
info = ("Bonjour" + User[NumeroIndexUser])
self.label= Tk.Label(self, text = info)
self.label.grid(row = 2)
def Install(self):
print ("dd")
TEXT = ["voila ","zozo","dd", "info diverses"]
counter = -1
def counter_label(labelInfo):
def count():
global counter
counter += 1
if counter == len(TEXT):
print ("quitter")
## self.destroy()
else:
labelInfo.config(self, text=TEXT[counter])
labelInfo.after(2000, count)
count()
self.labelInfo = Tk.Label(self, fg="green")
self.labelInfo.grid(row = 3)
if __name__ == "__main__":
app = Identification()
app.title ("Identification")
app.mainloop() |
Partager