from tkinter import * def adresse_reseau(): ip_address = IP_entree.get() mask_mask = Mask_entree.get() # Calculate the network address by performing an AND operation between the IP address and subnet mask Adresse_reseau = '.'.join(str(int(ip_part) & int(mask_part)) for ip_part, mask_part in zip(ip_address.split('.'), mask_mask.split('.'))) # Display the network address network_label.config(text='Network Address: ' + Adresse_reseau) fenetre= Tk() #créé la fenetre principale IP_label = Label(fenetre, text="Adresse IP:") IP_label.grid(row=0, column=0) IP_entree = Entry(fenetre, width=15) IP_entree.grid(row=0, column=1) Mask_label = Label(fenetre, text="Masque de sous reseau:") Mask_label.grid(row=1, column=0) Mask_entree = Entry(fenetre, width=15) Mask_entree.grid(row=1, column=1) bouton=Button(fenetre, text="calculer", command = adresse_reseau) bouton.grid(row=4, column=1) network_label = Label(fenetre, text="") network_label.grid(row=5, column=0)