trystan.deneuve
7 months ago
commit
b825be5567
1 changed files with 29 additions and 0 deletions
@ -0,0 +1,29 @@ |
|||
from tkinter import* |
|||
|
|||
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=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) |
|||
|
|||
|
Loading…
Reference in new issue