ui fixes expand widget on x and y works

This commit is contained in:
2025-08-10 20:51:12 +02:00
parent 8fcad26789
commit 052ed0a828
19 changed files with 930 additions and 1181 deletions

47
ui/log_window.py Normal file
View File

@@ -0,0 +1,47 @@
import tkinter as tk
from tkinter import ttk
from datetime import datetime
class LogWindow(tk.Toplevel):
def __init__(self, parent):
super().__init__(parent)
self.title("Log")
self.geometry("600x400")
self.protocol("WM_DELETE_WINDOW", self.withdraw) # Hide on close
log_container = tk.Frame(self)
log_container.pack(fill="both", expand=True, padx=10, pady=10)
self.log_text = tk.Text(
log_container,
wrap=tk.WORD,
font=("Consolas", 9),
bg="#1e1e1e",
fg="#d4d4d4",
insertbackground="white",
selectbackground="#264f78",
)
log_scrollbar = ttk.Scrollbar(
log_container, orient="vertical", command=self.log_text.yview
)
self.log_text.configure(yscrollcommand=log_scrollbar.set)
self.log_text.pack(side="left", fill="both", expand=True)
log_scrollbar.pack(side="right", fill="y")
self.withdraw() # Start hidden
def log_message(self, message):
"""Add message to log"""
timestamp = datetime.now().strftime("%H:%M:%S")
log_entry = f"[{timestamp}] {message}\n"
self.log_text.insert(tk.END, log_entry)
self.log_text.see(tk.END)
self.log_text.update()
def toggle(self):
if self.winfo_viewable():
self.withdraw()
else:
self.deiconify()