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
| # Imports
from tkinter import *
import os.path
import subprocess
from subprocess import call
""" ******************************
DOCSTRING
Barre de lancement des modules
******************************
"""
# ____________________________________________________________________________________________________________________
# ____________________________________________________________________________________________________________________
# Création de l'instance Tk
fen0 =Tk()
# ____________________________________________________________________________________________________________________
# Les constantes
NOMDOS = os.getcwd() # Nom du dossier courant
# ____________________________________________________________________________________________________________________
# Les variables
varCoulPrinc = "Slate Gray"
varCoulSecond = "Gainsboro"
# ____________________________________________________________________________________________________________________
# Les fonctions
def foncLancCode():
call("python 1_Gestion_Codes.pyw")
def foncLancFic():
call("python 10_ChgFichiers.pyw")
# ____________________________________________________________________________________________________________________
# ____________________________________________________________________________________________________________________
# MAIN : Lancement du programme Principal
# ____________________________________________________________________________________________________________________
# Création fenêtre principale
fen0.geometry('300x200')
fen0.title("Fenêtre principale : lancement des modules")
fen0.configure(bg = varCoulPrinc)
# _______________________________________
# Création labels
lab01 = Label(fen0, text = "Gestion des codes",width=26, anchor ='w', bg=varCoulPrinc)
lab02 = Label(fen0, text = "Modification de fichiers",width=26 , anchor ='w', bg=varCoulPrinc)
# _______________________________________
# Création boutons internes
bouLancCode =Button(fen0, bg=varCoulPrinc, command=foncLancCode)
bouLancChgFic =Button(fen0, bg=varCoulPrinc, command=foncLancFic)
# Création boutons externe
butExit =Button(fen0, relief='raised', bg = varCoulPrinc, command=fen0.destroy)
# _______________________________________
# positionnement objets
bouLancCode.grid(row=1, column=1, pady = 5, padx = 5)
lab01.grid(row=1, column=2, pady = 5, padx = 5)
bouLancChgFic.grid(row=2, column=1, pady = 5, padx = 5)
lab02.grid(row=2, column=2, pady = 5, padx = 5)
# ______________________
butExit.grid(row=10, column=2, padx = 70, pady = 20)
centreFenetre(fen0)
# _______________________________________
# Réception d'événements
fen0.mainloop() |
Partager