|
| 1 | +import customtkinter as ctk |
| 2 | +from core.file_ops import new_file, open_file, save_file, save_file_as |
| 3 | +from core.runner import run_code |
| 4 | +from utils.highlighter import highlight |
| 5 | + |
| 6 | +def create_editor(parent): |
| 7 | + editor = ctk.CTkTextbox(parent, font=("Consolas", 14), wrap="none") |
| 8 | + editor.pack(fill="both", expand=True, padx=10, pady=(10, 5)) |
| 9 | + return editor |
| 10 | + |
| 11 | +def create_output(parent): |
| 12 | + output = ctk.CTkTextbox(parent, height=130, font=("Consolas", 12), text_color="lime") |
| 13 | + output.pack(fill="x", padx=10, pady=(0, 10)) |
| 14 | + return output |
| 15 | + |
| 16 | +def create_menu(parent, state): |
| 17 | + frame = ctk.CTkFrame(parent, height=40, fg_color="#1e1e1e") # dark toolbar style |
| 18 | + frame.pack(fill="x", padx=0, pady=0) |
| 19 | + |
| 20 | + button_style = { |
| 21 | + "corner_radius": 0, |
| 22 | + "height": 32, |
| 23 | + "fg_color": "#2d2d30", |
| 24 | + "hover_color": "#3e3e42", |
| 25 | + "text_color": "white" |
| 26 | + } |
| 27 | + |
| 28 | + ctk.CTkButton(frame, text="New", command=lambda: new_file(state), **button_style).pack(side="left", padx=(10, 4)) |
| 29 | + ctk.CTkButton(frame, text="Open", command=lambda: open_file(state, highlight), **button_style).pack(side="left", padx=4) |
| 30 | + ctk.CTkButton(frame, text="Save", command=lambda: save_file(state), **button_style).pack(side="left", padx=4) |
| 31 | + ctk.CTkButton(frame, text="Save As", command=lambda: save_file_as(state), **button_style).pack(side="left", padx=4) |
| 32 | + ctk.CTkButton(frame, text="Compile & Run", command=lambda: run_code(state), **button_style).pack(side="left", padx=(10, 4)) |
0 commit comments