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
|
# -*- coding: UTF-8 -*-
# Importation des module graphiques
from Tkinter import *
import tkFont
# Creation de la fenêtre principale
Mafenetre= Tk()
# On impose à la fenêtre de s'ouvrir "plein écran"
Mafenetre.wm_state(newstate="zoomed")
Mafenetre.title('test')
Mafenetre.configure(bg = 'lightblue', padx = 10, pady = 10)
Mafenetre.resizable(True, True)
police=tkFont.Font(Mafenetre, weight = 'bold', size = '10' )
police1=tkFont.Font(Mafenetre, weight = 'bold', size = '12' )
"""=============================================================================
Distance façades - égout
============================================================================="""
# Création d'un label (distance façades - égout)
Distance = Label(Mafenetre, text = "Entrez la distance façades -> egout : ", bg = 'lightblue', font = police)
#positionnement du label avec la methode pack()
Distance.grid(row = 0, column = 0, pady = 5, padx = 20, sticky = 'W')
# Création d'une entrée (pour la distance)
Dist = Entry(Mafenetre , width = 20, bg = 'bisque', font = police)
# positionnement
Dist.grid(row = 0, column = 1)
MetreDist = Label(Mafenetre, text = "M", bg= 'lightblue', font = police)
MetreDist.grid(row = 0, column = 2, sticky = 'W')
"""=============================================================================
Largeur de trottoir
============================================================================="""
# Création d'un label (Largeur de trottoir)
Trottoir = Label(Mafenetre, text = "Quelle est la Largeur de trottoir ? ", bg = 'lightblue', font = police)
#positionnement du label avec la methode pack()
Trottoir.grid(row = 0, column = 3, pady = 5, padx = 20, sticky = 'W')
# Création d'une entrée (pour le trottoir)
Trott = Entry(Mafenetre , width = 20, bg = 'bisque', font = police)
# positionnement
Trott.grid(row = 0, column = 4)
MetreTrott = Label(Mafenetre, text = "M", bg= 'lightblue', font = police)
MetreTrott.grid(row = 0, column = 5, sticky = 'W')
"""=============================================================================
Largeur de stationnement
============================================================================="""
# Création d'un label (Largeur de stationnement)
Stationnement = Label(Mafenetre, text = "Quelle est la Largeur de stationnement ? ", bg = 'lightblue', font = police)
#positionnement du label avec la methode pack()
Stationnement.grid(row = 0, column = 6, pady = 5, padx = 20, sticky = 'W')
# Création d'une entrée (pour le trottoir)
Stat = Entry(Mafenetre , width = 20, bg = 'bisque', font = police)
# positionnement
Stat.grid(row = 0, column = 7)
MetreStat = Label(Mafenetre, text = "M", bg= 'lightblue', font = police)
MetreStat.grid(row = 0, column = 8, sticky = 'W')
"""=============================================================================
Largeur de la voirie (que l'on peut déterminer grâce aux données déja entrées)
============================================================================="""
aDist = float(Dist.get())
bTrott = float(Trott.get())
cStat = float(Stat.get())
Voirie = aDist-bTrott-cStat
Voirie1 = round(Voirie)
LabelResultVoirie.config(text = str(Voirie1)+ ' M')
# Création d'un label (Largeur de voirie)
LabelVoirie = Label(Mafenetre, text = "La largeur de voirie est donc de : ", bg = 'lightblue', font = police)
#positionnement du label avec la methode pack()
LabelVoirie.grid(row = 1, column = 2, pady = 5, padx = 20, sticky = 'W')
# Création d'un label (Résultat largeur de voirie)
LabelResultvoirie = Label ( bg = 'lightblue', fg = 'red', font = police1)
LabelResultvoirie.grid(row = 1, column = 3)
# Ouvertue de la fenêtre à l'écran
Mafenetre.mainloop() |
Partager