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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
"""
Created on Tue Mar 29 17:35:16 2022
@author: D57577
"""
import csv
from tkinter.ttk import *
from tkinter import *
# RECUPERATION DONNEES CSV
filepath = './DATA.csv'
file = open(filepath)
reader = csv.reader(file, delimiter = ';')
data = list(reader)
del(data[0])
# DEFINITIONS DES FONCTIONS
def recupdonnees():
index = cbx1.current()
lbl_CHAINE2.config(text=data[index][0])
lbl_SYSTEME2.config(text=data[index][1])
lbl_DETECTEUR2.config(text=data[index][2])
lbl_COFFRET2.config(text=data[index][3])
lbl_INR2.config(text=data[index][4])
for item in tab_doc.get_children():
tab_doc.delete(item)
tab_doc.insert ( "" , 1 , "L01" , text = "Schéma élec" , values = ( "Schéma" , data[index][15], "Lien"))
tab_doc.insert ( "" , 2 , "L02" , text = "GEE" )
tab_doc.insert ( "L02" , "end" , "L0201" , text = "Section 00" ,values = ( "Note technique" ,data[index][5], data[index][11]) )
tab_doc.insert ( "L02" , "end" , "L0202" , text = "Section 0" ,values = ( "Note technique" ,data[index][6], data[index][11]) )
tab_doc.insert ( "L02" , "end" , "L0203" , text = "Section 01" ,values = ( "Note technique" ,data[index][7], data[index][11]) )
tab_doc.insert ( "" , 3 , "L03" , text = "DSE" )
tab_doc.insert ( "L03" , "end" , "L0301" , text = "Chapitre 1" ,values = ( "Note technique" ,data[index][12], "Lien") )
tab_doc.insert ( "L03" , "end" , "L0302" , text = "Chapitre 2" ,values = ( "Note technique" ,data[index][12], "Lien") )
tab_doc.insert ( "L03" , "end" , "L0303" , text = "Chapitre 3" ,values = ( "Note technique" ,data[index][13], "Lien") )
return(0)
# CORPS PRINCIPAL DU PROGRAMME
fenetre = Tk()
fenetre.title("Test")
fenetre.geometry("800x800")
#Liste chaines
liste_chaines = []
for x in list (range(0,len(data))):
liste_chaines.append(data[x][0])
#
cbx1 = Combobox(fenetre, values=liste_chaines)
cbx1.grid(row=0,column=0, ipady=3, padx=2,pady=2)
#Bouton choix chaînes
btn1=Button(fenetre, text="Choix de la chaîne", command=recupdonnees)
btn1.grid(row=1,column=0, ipady=3, padx=2,pady=2)
#---- FRAME X ----#
# Frame contenant les infos de la chaine KRT
zone1 = Frame(fenetre, bg='#666666',width=300, height=200, borderwidth=1)
lbl_CHAINE=Label(zone1, text="Chaine :")
lbl_CHAINE2=Label(zone1, text="")
lbl_SYSTEME=Label(zone1, text="Système :")
lbl_SYSTEME2=Label(zone1, text="")
lbl_DETECTEUR=Label(zone1, text="Détecteur :")
lbl_DETECTEUR2=Label(zone1, text="")
lbl_COFFRET=Label(zone1, text="Coffret :")
lbl_COFFRET2=Label(zone1, text="")
lbl_INR=Label(zone1, text="INR :")
lbl_INR2=Label(zone1, text="")
#
zone1.grid_propagate(False)
zone1.grid(row=2,column=0, padx=10, pady=10)
lbl_CHAINE.grid(row=0,column=0, sticky='w',pady=2,padx=2)
lbl_CHAINE2.grid(row=0,column=1, sticky='w',pady=2,padx=2)
lbl_SYSTEME.grid(row=1,column=0, sticky='w',pady=2,padx=2)
lbl_SYSTEME2.grid(row=1,column=1, sticky='w',pady=2,padx=2)
lbl_DETECTEUR.grid(row=2,column=0, sticky='w',pady=2,padx=2)
lbl_DETECTEUR2.grid(row=2,column=1, sticky='w',pady=2,padx=2)
lbl_COFFRET.grid(row=3,column=0, sticky='w',pady=2,padx=2)
lbl_COFFRET2.grid(row=3,column=1, sticky='w',pady=2,padx=2)
lbl_INR.grid(row=4,column=0, sticky='w',pady=2,padx=2)
lbl_INR2.grid(row=4,column=1, sticky='w',pady=2,padx=2)
#---- FRAME X ----#
# Frame contenant la disponibilité des chaines
zone2 = Frame(fenetre, bg='#666666',width=300, height=200, borderwidth=1)
lbl_dRP=Label(zone2, text="En RP :")
#
zone2.grid_propagate(False)
zone2.grid(row=2,column=1, padx=10,pady=10)
lbl_dRP.grid(row=1,column=1, ipady=2, padx=2,pady=2)
#---- FRAME X ----#
# Frame contenant la documentation des chaines
# Colonnes tableau
zone3 = Frame(fenetre, bg='#666666',width=600, height=300, borderwidth=1)
zone3.grid_propagate(False)
zone3.grid(row=3,column=0, padx=10,pady=10,columnspan=2)
tab_doc = Treeview ( zone3 , columns = ( "Type" , "Reference" , "Lien" ) )
tab_doc.column ( "#0" , width = 150 , minwidth = 150 , stretch = False )
tab_doc.column ( "Type" , width = 150 , minwidth = 150 , stretch = False )
tab_doc.column ( "Reference" , width = 100 , minwidth = 100 , stretch = False )
tab_doc.column ( "Lien" , width = 100 , minwidth = 100 , stretch = False )
tab_doc.heading ( "Type" , text = "Type de document" , anchor = "center" )
tab_doc.heading ( "Reference" , text = "Référence" , anchor = "center" )
tab_doc.heading ( "Lien" , text = "Lien vers dossier" , anchor = "center" )
tab_doc.grid ()
fenetre.mainloop() |
Partager