From c7d990f1808620d6f1634adf39d012d64526e69d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ruthotto?= Date: Fri, 30 Aug 2024 09:00:43 +0200 Subject: [PATCH] add UI --- src/main.py | 3 ++- src/views/mainScreen.py | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/main.py b/src/main.py index 55aec56..1f70e89 100644 --- a/src/main.py +++ b/src/main.py @@ -11,10 +11,11 @@ class Main(customtkinter.CTk): mainFrame = MainFrame(self) mainFrame.grid(row=0, column=0, padx=10, pady=10,sticky="nsew") self.title("VeracityAI") - self.geometry("1300x800") + self.geometry("800x500") if __name__ == "__main__": + customtkinter.deactivate_automatic_dpi_awareness() customtkinter.set_appearance_mode("dark") app = Main() app.mainloop() \ No newline at end of file diff --git a/src/views/mainScreen.py b/src/views/mainScreen.py index 332125b..b967203 100644 --- a/src/views/mainScreen.py +++ b/src/views/mainScreen.py @@ -1,4 +1,4 @@ -from typing import Any, Tuple +from typing import Any import customtkinter as ctk class MainFrame(ctk.CTkFrame): @@ -6,16 +6,35 @@ class MainFrame(ctk.CTkFrame): def __init__(self, master: Any, **kwargs): super().__init__(master, **kwargs) - entry_url = ctk.CTkEntry(self, placeholder_text='Web link to article', width=290, height=50) - entry_url.grid(row=0, column=0, padx=20, pady=10) + # Konfiguriere das Hauptframe, um sich zu dehnen + self.grid_rowconfigure(0, weight=1) + self.grid_columnconfigure(0, weight=1) # Linke Spalte soll sich dehnen + self.grid_columnconfigure(1, weight=0) # Mittlere Spalte (Button) soll sich nicht dehnen + self.grid_columnconfigure(2, weight=1) # Rechte Spalte soll sich dehnen - input_textbox = ctk.CTkTextbox(self, width=290, height=200) - input_textbox.grid(row=1,column=0, padx=10, pady=10) + # Linkes Frame + frame1 = ctk.CTkFrame(self) + frame1.grid(row=0, column=0, sticky="nsew", padx=10, pady=10) + frame1.grid_rowconfigure(2, weight=1) # Lasse die Output-Textbox wachsen + frame1.grid_columnconfigure(0, weight=1) # Lasse frame1 horizontal wachsen - output_textbox = ctk.CTkTextbox(self, width=290, height=150, state= "disabled") - output_textbox.grid(row=2,column=0, padx=10, pady=10) + entry_url = ctk.CTkEntry(frame1, placeholder_text='Web link to article', height=50) + entry_url.grid(row=0, column=0, padx=10, pady=10, sticky="ew") - check_button = ctk.CTkButton(self,text="Check",width=100,height=50) - check_button.grid(row=0,column=1, padx=10, pady=10, sticky="nsew") + input_textbox = ctk.CTkTextbox(frame1, height=200) + input_textbox.grid(row=1, column=0, padx=10, pady=10, sticky="nsew") - \ No newline at end of file + output_textbox = ctk.CTkTextbox(frame1, height=150, state="disabled") + output_textbox.grid(row=2, column=0, padx=10, pady=10, sticky="nsew") + + # Mittlerer Button + check_button = ctk.CTkButton(self, text="Check", width=60, height=300, fg_color="green") + check_button.grid(row=0, column=1, padx=10, pady=10, sticky="nsew") + + # Rechte scrollbare Ansicht + scrollview = ctk.CTkScrollableFrame(self) + scrollview.grid(row=0, column=2, padx=10, pady=10, sticky="nsew") + + # Überschrift hinzufügen + header = ctk.CTkLabel(scrollview, text="Leaderboard", font=("Arial", 24, "bold")) + header.pack(pady=10, padx=10, anchor="w") \ No newline at end of file