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.

34 lines
918 B

from tkinter import *
def calcul():
adresse_ip = value1.get()
masque = value2.get()
adresse_ip = adresse_ip.split(".")
masque = masque.split(".")
resultat = []
resultat.append(int(adresse_ip[0]) & int(masque[0]))
resultat.append(int(adresse_ip[1]) & int(masque[1]))
resultat.append(int(adresse_ip[2]) & int(masque[2]))
resultat.append(int(adresse_ip[3]) & int(masque[3]))
label.configure(text=resultat)
fenetre = Tk()
value1 = StringVar()
value1.set("Saisir l'adresse IP")
entree1 = Entry(fenetre, textvariable=value1, width=30)
entree1.pack()
value2 = StringVar()
value2.set("Saisir le masque de sous réseau")
entree2 = Entry(fenetre, textvariable=value2, width=30)
entree2.pack()
bouton = Button(fenetre, text ='calcul', command=calcul, bg="pink")
bouton.pack()
label = Label(fenetre, text="adresse IP du reseau")
label.pack()
fenetre.mainloop()
fenetre.destroy()