Skip to content

Commit c223937

Browse files
committed
Modernized GUI
This gui looks more modern and nice
1 parent 977a527 commit c223937

File tree

1 file changed

+41
-23
lines changed

1 file changed

+41
-23
lines changed

gui.py

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@
33
from PIL import Image, ImageTk
44
from ideeplc.ideeplc_core import main as run_ideeplc
55
import argparse
6-
import sys
76
import os
7+
import requests
8+
9+
10+
PRIMARY_BG = "#1e1e2e"
11+
ACCENT = "#2d2d46"
12+
TEXT_COLOR = "#f5f5f5"
13+
BUTTON_COLOR = "#313244"
14+
BUTTON_HOVER = "#45475a"
15+
FONT = ("Segoe UI", 11)
816

917

1018
def run_prediction(input_path, calibrate, finetune):
@@ -33,53 +41,63 @@ def browse_file(entry_field):
3341
entry_field.insert(0, filepath)
3442

3543

44+
def style_button(btn):
45+
btn.configure(bg=BUTTON_COLOR, fg=TEXT_COLOR, activebackground=BUTTON_HOVER,
46+
relief="flat", font=FONT, cursor="hand2")
47+
btn.bind("<Enter>", lambda e: btn.config(bg=BUTTON_HOVER))
48+
btn.bind("<Leave>", lambda e: btn.config(bg=BUTTON_COLOR))
49+
50+
3651
def launch_gui():
3752
root = tk.Tk()
3853
root.title("iDeepLC Predictor")
39-
root.geometry("600x400")
40-
root.configure(bg="#f0f0f0")
54+
root.geometry("700x550")
55+
root.configure(bg=PRIMARY_BG)
4156

4257
# Load and display the image
4358
img_url = "https://github.com/user-attachments/assets/86e9b793-39be-4f62-8119-5c6a333af487"
4459
img_path = "logo_temp.jpg"
45-
46-
# Download if not exists (for local runs)
4760
if not os.path.exists(img_path):
48-
import requests
4961
with open(img_path, "wb") as f:
5062
f.write(requests.get(img_url).content)
5163

5264
image = Image.open(img_path)
53-
image = image.resize((410,240))
65+
image = image.resize((450, 200), Image.LANCZOS)
5466
photo = ImageTk.PhotoImage(image)
55-
56-
image_label = tk.Label(root, image=photo, bg="#f0f0f0")
67+
image_label = tk.Label(root, image=photo, bg=PRIMARY_BG)
5768
image_label.image = photo
58-
image_label.pack(pady=(10, 0))
69+
image_label.pack(pady=(20, 10))
5970

60-
# Input file selection
61-
frame = tk.Frame(root, bg="#f0f0f0")
71+
# Input frame
72+
frame = tk.Frame(root, bg=PRIMARY_BG)
6273
frame.pack(pady=10)
6374

64-
tk.Label(frame, text="Input CSV:", bg="#f0f0f0").grid(row=0, column=0, padx=5, sticky='e')
65-
input_entry = tk.Entry(frame, width=40)
66-
input_entry.grid(row=0, column=1, padx=5)
67-
tk.Button(frame, text="Browse", command=lambda: browse_file(input_entry)).grid(row=0, column=2, padx=5)
75+
tk.Label(frame, text="Input CSV:", bg=PRIMARY_BG, fg=TEXT_COLOR, font=FONT).grid(row=0, column=0, padx=10)
76+
input_entry = tk.Entry(frame, width=45, font=FONT, bg="#2e2e3f", fg=TEXT_COLOR, insertbackground=TEXT_COLOR,
77+
relief="flat")
78+
input_entry.grid(row=0, column=1, padx=10)
79+
browse_btn = tk.Button(frame, text="Browse", command=lambda: browse_file(input_entry))
80+
style_button(browse_btn)
81+
browse_btn.grid(row=0, column=2, padx=10)
6882

69-
# Options
70-
options_frame = tk.Frame(root, bg="#f0f0f0")
71-
options_frame.pack(pady=10)
83+
# Options frame
84+
options_frame = tk.Frame(root, bg=PRIMARY_BG)
85+
options_frame.pack(pady=15)
7286

7387
calibrate_var = tk.BooleanVar()
7488
finetune_var = tk.BooleanVar()
7589

76-
tk.Checkbutton(options_frame, text="Calibrate", variable=calibrate_var, bg="#f0f0f0").pack(side=tk.LEFT, padx=10)
77-
tk.Checkbutton(options_frame, text="Fine-tune", variable=finetune_var, bg="#f0f0f0").pack(side=tk.LEFT, padx=10)
90+
tk.Checkbutton(options_frame, text="Calibrate", variable=calibrate_var,
91+
bg=PRIMARY_BG, fg=TEXT_COLOR, selectcolor=ACCENT, font=FONT, activebackground=PRIMARY_BG).pack(side=tk.LEFT, padx=20)
92+
tk.Checkbutton(options_frame, text="Fine-tune", variable=finetune_var,
93+
bg=PRIMARY_BG, fg=TEXT_COLOR, selectcolor=ACCENT, font=FONT, activebackground=PRIMARY_BG).pack(side=tk.LEFT, padx=20)
7894

7995
# Run button
80-
run_btn = tk.Button(root, text="Run Prediction", bg="#4CAF50", fg="white", font=("Arial", 12, "bold"),
96+
run_btn = tk.Button(root, text="Run Prediction",
8197
command=lambda: run_prediction(input_entry.get(), calibrate_var.get(), finetune_var.get()))
82-
run_btn.pack(pady=20)
98+
style_button(run_btn)
99+
run_btn.config(font=("Segoe UI", 12, "bold"), width=20)
100+
run_btn.pack(pady=30)
83101

84102
root.mainloop()
85103

0 commit comments

Comments
 (0)