Initial commit

This commit is contained in:
2026-02-20 02:10:49 +01:00
commit c68c881f28
9 changed files with 275 additions and 0 deletions

82
main.py Executable file
View File

@@ -0,0 +1,82 @@
import tkinter as tk
from PIL import Image, ImageTk
from wetter_api import get_braunschweig_wetter
#Fenster
root = tk.Tk()
#Fenstername
root.title("GLaDOS βφ")
#Backgroundfarbedefinition
bg_color ="#000000"
#Schriftfarbendefinition
fg_color ="#ff0000"
#Fensterhintergrund
root.configure(bg=bg_color)
#Fontanpassungen
my_font = ("Diablo",35)
#Fenstericon Umwandeln
img_original = Image.open("Glados.png")
img_resized = img_original.resize((64,64),Image.Resampling.LANCZOS)
icon_img = ImageTk.PhotoImage(img_resized)
root.iconphoto(False, icon_img)
#Deffinition der Startweite vom Fenster
window_width = 800 #fix ggf für pi bildschirm
window_height = 600
#Abfrage der Bildschirmwerte
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
#Berechnung für Mitte des Bildschirms
center_x = int(screen_width/2 - window_width/2)
center_y = int(screen_height/2 - window_height/2)
#Fenstergeometrie Definition
root.geometry(f"{window_width}x{window_height}+{center_x}+{center_y}")
#Funktion für Vollbild (not statment für F11 an und aus = einem Schalter)
def toggle_fullscreen(event=None):
root.attributes("-fullscreen",not root.attributes("-fullscreen"))
#Funktion für Vollbild beenden alternativ
def end_fullscreen(event=None):
root.attributes("-fullscreen",False)
#Tastendefinitionen
root.bind("<F11>", toggle_fullscreen)
root.bind("<Escape>", end_fullscreen)
#untere Leiste Definition
status = tk.Label(
root,
text="F11: Vollbild | ESC: Beenden",
anchor="w",# Links
padx=10,#10 Pixel vom Randweg
bg="#222",#Hintergrundfarbe
fg="#ddd"#Schriftfarbe
)
#Leiste ins Fensterpacken
status.pack(side="bottom",fill="x")
#Dinge ins Fenster
wetter_daten = get_braunschweig_wetter()
wetteranzeige =""
for tag in wetter_daten:
wetteranzeige += f"{tag['Tag']}.{tag['Monat']}.{tag['Jahr']}:von {tag['Min']}°C bis {tag['Max']}°C - {tag['code']}\n"
message = tk.Label(root, text="Wettervorhersage für Braunschweig",fg=fg_color,bg=bg_color,font=my_font).pack()
wetter = tk.Label(root, text=wetteranzeige, fg=fg_color, bg=bg_color, font=my_font).pack()
#Fensterloop
root.mainloop()