You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
#projet 7 interface graphique
|
|
import tkinter as tk
|
|
|
|
#Fonctions
|
|
def recup():
|
|
message = value.get()
|
|
label.configure(text=message)
|
|
|
|
def reseau():
|
|
ip = Entree
|
|
masque = Entree1
|
|
lstIP = ip.split(".")
|
|
lstMasque = masque.split(".")
|
|
lstReseau = [' ']*4
|
|
for i in range(4):
|
|
lstReseau[i] =str(lstIP[i])&int(lstMasque[i])
|
|
|
|
def adr_reseau_f():
|
|
reseau_f= ".".join(lstReseau)
|
|
|
|
|
|
|
|
|
|
#Creation de la fenetre
|
|
fenetre =tk.Tk()
|
|
fenetre.title("Calcul d'IP")
|
|
canvas=tk.Canvas(width=500,height=500,bg="ivory")
|
|
canvas.grid()
|
|
label =tk.Label(fenetre, text="Calcul de l'adresse réseau")
|
|
label.grid()
|
|
|
|
#Entrées et bouton valider
|
|
value = tk.StringVar()
|
|
value.set("Entrez votre adresse")
|
|
Entree=tk.Entry(fenetre, textvariable=value, width=20)
|
|
Entree.grid()
|
|
value = tk.StringVar()
|
|
value.set("Entrez votre masque")
|
|
Entree1=tk.Entry(fenetre, textvariable=value, width=20)
|
|
Entree1.grid()
|
|
bouton =tk.Button(text="valider", command=recup,)
|
|
bouton.grid()
|
|
label_rsultat =tk.Label(fenetre, text="Adresse réseau , adr_reseau_f()")
|
|
label_rsultat.grid()
|
|
|
|
fenetre.mainloop()
|