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
|
#coding: utf8
from Tkinter import *
import xlrd, xlwt
import os
my_window=Tk()
my_window.geometry('400x400+100+100')
my_window.title("Paramétres")
my_window.iconbitmap("C:/Users/nherv/Dropbox/logo.ico")
titre = Label(my_window,text="Paramétres et constantes :",font = "Times 12 bold", underline = 1).pack()
Label_window = Label(my_window, text="Variable est constantes")
#Mettre l'icone de la fenetre
""" Fonction de mise a jour pour recreé le fichier excel """
def MAJ():
MAJ_V1=entry_1.get()
ma_var1.set(MAJ_V1)
entry_1= Entry(my_window,state=NORMAL,width='50',textvariable=MAJ_V1,justify='left',bg="#DDD8D8",relief=FLAT).place(x=20,y=100)
#initialisation du bouton
button=Button(my_window,text = "ENREGISTRER", font ="Times 12 bold", command= MAJ).place(x="250",y="350")
#Les différentes text (Label) a afficher
chapitre1 = Label(my_window,text="Les constantes :",fg = "red",font = "Times 12 bold").place(x="20",y="50")
chapitre11= Label(my_window,text="Emplacement GDB RECOLEMENT :",font = "Times 10").place(x="20",y="75")
#Ouverture fichier excel
myBook = xlrd.open_workbook('Classeur1.xls')
feuille_1 = myBook.sheet_by_name("Feuil1")
#Recherche de la valeur contenu dans la cellule A1 de le feuille 1
V1 = feuille_1.cell_value(rowx=0, colx=0)
ma_var1 = StringVar()
ma_var1.set(V1)
print V1
#Affichage de la valeur en A1 dans le widget entry_1
entry_1 = Entry(my_window,state=NORMAL,width='50',textvariable=ma_var1,justify='left',bg="#DDD8D8",relief=FLAT).place(x=20,y=100)
my_window.mainloop() |
Partager