import tkinter as tk from tkinter import ttk tools = ["New", "Open", "Save", "App Details", "Import", "Run", "Export"] app_title = "Thermal / Flow Network Solver" app_name = "App Name" components = [ "Nodes", "Resistors", "FF Branch", "DP Branch", "Fixed P", "Pump", "Fan", "Sink", "Source", "Fixed T", "HTC", "Heat Flux", "Radiation", "Adiabatic" ] tab_bar_name = "Conduction.net ✕" class GeneralGuiDesigner(tk.Tk): def __init__(self): super().__init__() self.title(app_title) self.geometry("1100x750") self.configure(bg="#f0f0f0") # Configure style self.style = ttk.Style() self.style.theme_use("clam") # Build UI Components self.create_top_ribbon() self.create_tab_bar() self.create_main_workspace() def create_top_ribbon(self): """Creates the top ribbon toolbar """ ribbon_frame = ttk.Frame(self, style="TFrame") ribbon_frame.pack(side=tk.TOP, fill=tk.X, padx=2, pady=2) # DESIGNER header label header_label = ttk.Label( ribbon_frame, text=app_name, font=("Arial", 9, "bold") ) header_label.pack(anchor=tk.W, padx=5, pady=2) # Toolbar buttons frame toolbar = ttk.Frame( ribbon_frame, relief=tk.RAISED, borderwidth=1 ) toolbar.pack(side=tk.TOP, fill=tk.X, expand=True) for tool in tools: btn = ttk.Button(toolbar, text=tool, width=10) btn.pack(side=tk.LEFT, padx=2, pady=2) def create_tab_bar(self): """Creates the file tab bar below the ribbon.""" tab_frame = tk.Frame(self, bg="#d4d4d4", height=30) tab_frame.pack(side=tk.TOP, fill=tk.X) # Active file tab file_tab = tk.Button( tab_frame, text=tab_bar_name, font=("Arial", 9), bg="white", relief=tk.FLAT, bd=0 ) file_tab.pack(side=tk.LEFT, padx=2, pady=2) def create_main_workspace(self): """Creates the main workspace split into Component Library and Display Area.""" main_paned = ttk.PanedWindow(self, orient=tk.HORIZONTAL) main_paned.pack(fill=tk.BOTH, expand=True, padx=2, pady=2) # Left Panel: Component Library left_panel = ttk.Frame(main_paned, width=240, relief=tk.SUNKEN) main_paned.add(left_panel, weight=1) lib_title = ttk.Label( left_panel, text="COMPONENT LIBRARY", font=("Arial", 9, "bold") ) lib_title.pack(anchor=tk.W, padx=5, pady=5) # Search bar search_frame = ttk.Frame(left_panel) search_frame.pack(fill=tk.X, padx=5, pady=5) search_entry = ttk.Entry(search_frame) search_entry.insert(0, "Search") search_entry.pack(side=tk.LEFT, fill=tk.X, expand=True) # Common components section container (Scrollable area simulation) canvas_container = tk.Canvas( left_panel, bg="white", highlightthickness=0 ) scrollbar = ttk.Scrollbar( left_panel, orient="vertical", command=canvas_container.yview ) scrollable_frame = ttk.Frame(canvas_container, style="TFrame") scrollable_frame.bind( "", lambda e: canvas_container.configure( scrollregion=canvas_container.bbox("all") ) ) canvas_container.create_window((0, 0), window=scrollable_frame, anchor="nw") canvas_container.configure(yscrollcommand=scrollbar.set) canvas_container.pack( side=tk.LEFT, fill=tk.BOTH, expand=True, padx=5, pady=5 ) scrollbar.pack(side=tk.RIGHT, fill=tk.Y) # Add components list matching the image common_label = ttk.Label( scrollable_frame, text="COMMON", font=("Arial", 8, "bold"), foreground="gray" ) common_label.pack(anchor=tk.W, padx=5, pady=2) for comp in components: comp_btn = ttk.Button(scrollable_frame, text=comp, width=25) comp_btn.pack(anchor=tk.W, padx=10, pady=3) # Right Panel: Display Area Canvas right_panel = ttk.Frame(main_paned, relief=tk.SUNKEN) main_paned.add(right_panel, weight=4) display_canvas = tk.Canvas(right_panel, bg="white") display_canvas.pack(fill=tk.BOTH, expand=True, padx=5, pady=5) # Display Area Label in the center display_canvas.create_text( 400, 300, text="DISPLAY AREA", font=("Arial", 16, "bold"), fill="black" ) def show_about(self): messagebox.showinfo("About", "Network Solver Built using Tkinter.") def not_implemented(self): messagebox.showinfo("Action", "This feature is a placeholder.") if __name__ == "__main__": app = GeneralGuiDesigner() app.mainloop()