From 5eeb4fb0912d38f49654b7459fd42cb30abda1f0 Mon Sep 17 00:00:00 2001 From: "trystan.deneuve" Date: Mon, 29 Apr 2024 11:20:59 +0200 Subject: [PATCH] ajout de mon prjojet perso --- IP_claculateur.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/IP_claculateur.py b/IP_claculateur.py index 00c485a..642d345 100644 --- a/IP_claculateur.py +++ b/IP_claculateur.py @@ -1,4 +1,12 @@ -from tkinter import* +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 @@ -16,14 +24,4 @@ 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=1) - -def adresse_reseau(): - IP_Label = IP_Label.get() - Mask_Label = Mask_Label.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) - - +network_label.grid(row=5, column=0) \ No newline at end of file