|
|
@ -3,22 +3,19 @@ import tkinter as tk |
|
|
|
|
|
|
|
|
#Fonctions |
|
|
#Fonctions |
|
|
def recup(): |
|
|
def recup(): |
|
|
message = value.get() |
|
|
message = reseau() |
|
|
label.configure(text=message) |
|
|
label.configure(text=message) |
|
|
|
|
|
|
|
|
def reseau(): |
|
|
def reseau(): |
|
|
ip = Entree |
|
|
ip = Entree.get() |
|
|
masque = Entree1 |
|
|
masque = Entree1.get() |
|
|
lstIP = ip.split(".") |
|
|
lstIP = ip.split(".") |
|
|
lstMasque = masque.split(".") |
|
|
lstMasque = masque.split(".") |
|
|
lstReseau = [' ']*4 |
|
|
lstReseau = [' ']*4 |
|
|
for i in range(4): |
|
|
for i in range(4): |
|
|
lstReseau[i] =str(lstIP[i])&int(lstMasque[i]) |
|
|
lstReseau[i] =str(lstIP[i])&int(lstMasque[i]) |
|
|
|
|
|
|
|
|
def adr_reseau_f(): |
|
|
|
|
|
reseau_f= ".".join(lstReseau) |
|
|
reseau_f= ".".join(lstReseau) |
|
|
|
|
|
label_rsultat=tk.Label(fenetre, text="Adresse réseau :{reseau_f}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Creation de la fenetre |
|
|
#Creation de la fenetre |
|
|
@ -34,13 +31,11 @@ value = tk.StringVar() |
|
|
value.set("Entrez votre adresse") |
|
|
value.set("Entrez votre adresse") |
|
|
Entree=tk.Entry(fenetre, textvariable=value, width=20) |
|
|
Entree=tk.Entry(fenetre, textvariable=value, width=20) |
|
|
Entree.grid() |
|
|
Entree.grid() |
|
|
value = tk.StringVar() |
|
|
value1 = tk.StringVar() |
|
|
value.set("Entrez votre masque") |
|
|
value1.set("Entrez votre masque") |
|
|
Entree1=tk.Entry(fenetre, textvariable=value, width=20) |
|
|
Entree1=tk.Entry(fenetre, textvariable=value1, width=20) |
|
|
Entree1.grid() |
|
|
Entree1.grid() |
|
|
bouton =tk.Button(text="valider", command=recup,) |
|
|
bouton =tk.Button(text="valider", command=recup) |
|
|
bouton.grid() |
|
|
bouton.grid() |
|
|
label_rsultat =tk.Label(fenetre, text="Adresse réseau , adr_reseau_f()") |
|
|
|
|
|
label_rsultat.grid() |
|
|
|
|
|
|
|
|
|
|
|
fenetre.mainloop() |
|
|
fenetre.mainloop() |