-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui_module.py
More file actions
38 lines (32 loc) · 1.06 KB
/
Copy pathgui_module.py
File metadata and controls
38 lines (32 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import tkinter as tk
from tkinter import ttk
def starte_gui(on_closing_callback):
"""Erstellt das Live-Fenster des Netzwerkmonitors."""
root = tk.Tk()
root.title("Netzwerk Monitor")
root.geometry("480x340")
root.resizable(False, False)
ttk.Label(
root,
text="Netzwerk Monitor aktiv",
font=("Arial", 14, "bold"),
).pack(pady=15)
frame = ttk.LabelFrame(root, text=" Live-Werte ", padding=12)
frame.pack(fill="x", padx=20, pady=5)
labels = {}
for key, text in (
("connection", "Verbindung: --"),
("latency", "Latenz: -- ms"),
("upload", "Upload: --"),
("download", "Download: --"),
("interfaces", "Aktive Interfaces: --"),
):
labels[key] = ttk.Label(frame, text=text, font=("Arial", 10))
labels[key].pack(anchor="w", pady=3)
ttk.Button(
root,
text="Programm beenden",
command=lambda: on_closing_callback(root),
).pack(pady=15)
root.protocol("WM_DELETE_WINDOW", lambda: on_closing_callback(root))
return root, labels