Skip to content

Commit 46540ce

Browse files
committed
Revert "Add scrollbar"
This reverts commit 985f45d.
1 parent 985f45d commit 46540ce

File tree

1 file changed

+13
-45
lines changed

1 file changed

+13
-45
lines changed

python/inputmodule/gui/__init__.py

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,9 @@ def run_gui(devices):
4848
root.title("LED Matrix Control")
4949
root.geometry("400x900")
5050

51-
52-
# Scrollbar
53-
main_container = ttk.Frame(root)
54-
main_container.pack(fill="both", expand=True)
55-
canvas = tk.Canvas(main_container, bg="#2b2b2b")
56-
scrollbar = ttk.Scrollbar(main_container, orient="vertical", command=canvas.yview)
57-
content_frame = ttk.Frame(canvas, style="Content.TFrame")
58-
canvas.configure(yscrollcommand=scrollbar.set)
59-
scrollbar.pack(side="right", fill="y")
60-
canvas.pack(side="left", fill="both", expand=True)
61-
canvas_frame = canvas.create_window((0, 0), window=content_frame, anchor="nw")
62-
63-
6451
# Configure dark theme
6552
style = ttk.Style()
6653
root.configure(bg="#2b2b2b")
67-
style.configure("Content.TFrame", background="#2b2b2b")
6854
style.configure("TLabelframe", background="#2b2b2b", foreground="white")
6955
style.configure("TLabelframe.Label", background="#2b2b2b", foreground="white")
7056
style.configure("TCheckbutton", background="#2b2b2b", foreground="white")
@@ -79,7 +65,7 @@ def run_gui(devices):
7965
style.map("TButton", background=[("active", "gray"), ("!active", "#2b2b2b")])
8066

8167
# Device Checkboxes
82-
detected_devices_frame = ttk.LabelFrame(content_frame, text="Detected Devices", style="TLabelframe")
68+
detected_devices_frame = ttk.LabelFrame(root, text="Detected Devices", style="TLabelframe")
8369
detected_devices_frame.pack(fill="x", padx=10, pady=5)
8470

8571
global device_checkboxes
@@ -95,7 +81,7 @@ def run_gui(devices):
9581
device_checkboxes[dev.name] = checkbox_var
9682

9783
# Device Control Buttons
98-
device_control_frame = ttk.LabelFrame(content_frame, text="Device Control", style="TLabelframe")
84+
device_control_frame = ttk.LabelFrame(root, text="Device Control", style="TLabelframe")
9985
device_control_frame.pack(fill="x", padx=10, pady=5)
10086
control_buttons = {
10187
"Bootloader": "bootloader",
@@ -106,15 +92,15 @@ def run_gui(devices):
10692
ttk.Button(device_control_frame, text=text, command=lambda a=action: perform_action(devices, a), style="TButton").pack(side="left", padx=5, pady=5)
10793

10894
# Brightness Slider
109-
brightness_frame = ttk.LabelFrame(content_frame, text="Brightness", style="TLabelframe")
95+
brightness_frame = ttk.LabelFrame(root, text="Brightness", style="TLabelframe")
11096
brightness_frame.pack(fill="x", padx=10, pady=5)
11197
global brightness_scale
11298
brightness_scale = tk.Scale(brightness_frame, from_=0, to=255, orient='horizontal', command=lambda value: set_brightness(devices, value), bg="#2b2b2b", fg="white", troughcolor="gray", highlightbackground="#2b2b2b")
11399
brightness_scale.set(120) # Default value
114100
brightness_scale.pack(fill="x", padx=5, pady=5)
115101

116102
# Animation Control
117-
animation_frame = ttk.LabelFrame(content_frame, text="Animation", style="TLabelframe")
103+
animation_frame = ttk.LabelFrame(root, text="Animation", style="TLabelframe")
118104
animation_frame.pack(fill="x", padx=10, pady=5)
119105
animation_buttons = {
120106
"Start Animation": "start_animation",
@@ -124,20 +110,20 @@ def run_gui(devices):
124110
ttk.Button(animation_frame, text=text, command=lambda a=action: perform_action(devices, a), style="TButton").pack(side="left", padx=5, pady=5)
125111

126112
# Pattern Combo Box
127-
pattern_frame = ttk.LabelFrame(content_frame, text="Pattern", style="TLabelframe")
113+
pattern_frame = ttk.LabelFrame(root, text="Pattern", style="TLabelframe")
128114
pattern_frame.pack(fill="x", padx=10, pady=5)
129115
pattern_combo = ttk.Combobox(pattern_frame, values=PATTERNS, style="TCombobox")
130116
pattern_combo.pack(fill="x", padx=5, pady=5)
131117
pattern_combo.bind("<<ComboboxSelected>>", lambda event: set_pattern(devices, pattern_combo.get()))
132118

133119
# Percentage Slider
134-
percentage_frame = ttk.LabelFrame(content_frame, text="Fill screen X% (could be volume indicator)", style="TLabelframe")
120+
percentage_frame = ttk.LabelFrame(root, text="Fill screen X% (could be volume indicator)", style="TLabelframe")
135121
percentage_frame.pack(fill="x", padx=10, pady=5)
136122
percentage_scale = tk.Scale(percentage_frame, from_=0, to=100, orient='horizontal', command=lambda value: set_percentage(devices, value), bg="#2b2b2b", fg="white", troughcolor="gray", highlightbackground="#2b2b2b")
137123
percentage_scale.pack(fill="x", padx=5, pady=5)
138124

139125
# Countdown Timer
140-
countdown_frame = ttk.LabelFrame(content_frame, text="Countdown Timer", style="TLabelframe")
126+
countdown_frame = ttk.LabelFrame(root, text="Countdown Timer", style="TLabelframe")
141127
countdown_frame.pack(fill="x", padx=10, pady=5)
142128
countdown_spinbox = tk.Spinbox(countdown_frame, from_=1, to=60, width=5, bg="#2b2b2b", fg="white", textvariable=tk.StringVar(value=10))
143129
countdown_spinbox.pack(side="left", padx=5, pady=5)
@@ -146,60 +132,42 @@ def run_gui(devices):
146132
ttk.Button(countdown_frame, text="Stop", command=stop_thread, style="TButton").pack(side="left", padx=5, pady=5)
147133

148134
# Black & White and Greyscale Images in same row
149-
image_frame = ttk.LabelFrame(content_frame, text="Black&White Images / Greyscale Images", style="TLabelframe")
135+
image_frame = ttk.LabelFrame(root, text="Black&White Images / Greyscale Images", style="TLabelframe")
150136
image_frame.pack(fill="x", padx=10, pady=5)
151137
ttk.Button(image_frame, text="Send stripe.gif", command=lambda: send_image(devices, "stripe.gif", image_bl), style="TButton").pack(side="left", padx=5, pady=5)
152138
ttk.Button(image_frame, text="Send greyscale.gif", command=lambda: send_image(devices, "greyscale.gif", image_greyscale), style="TButton").pack(side="left", padx=5, pady=5)
153139

154140
# Display Current Time
155-
time_frame = ttk.LabelFrame(content_frame, text="Display Current Time", style="TLabelframe")
141+
time_frame = ttk.LabelFrame(root, text="Display Current Time", style="TLabelframe")
156142
time_frame.pack(fill="x", padx=10, pady=5)
157143
ttk.Button(time_frame, text="Start", command=lambda: perform_action(devices, "start_time"), style="TButton").pack(side="left", padx=5, pady=5)
158144
ttk.Button(time_frame, text="Stop", command=stop_thread, style="TButton").pack(side="left", padx=5, pady=5)
159145

160146
# Custom Text
161-
custom_text_frame = ttk.LabelFrame(content_frame, text="Custom Text", style="TLabelframe")
147+
custom_text_frame = ttk.LabelFrame(root, text="Custom Text", style="TLabelframe")
162148
custom_text_frame.pack(fill="x", padx=10, pady=5)
163149
custom_text_entry = ttk.Entry(custom_text_frame, width=20, style="TEntry")
164150
custom_text_entry.pack(side="left", padx=5, pady=5)
165151
ttk.Button(custom_text_frame, text="Show", command=lambda: show_custom_text(devices, custom_text_entry.get()), style="TButton").pack(side="left", padx=5, pady=5)
166152

167153
# Display Text with Symbols
168-
symbols_frame = ttk.LabelFrame(content_frame, text="Display Text with Symbols", style="TLabelframe")
154+
symbols_frame = ttk.LabelFrame(root, text="Display Text with Symbols", style="TLabelframe")
169155
symbols_frame.pack(fill="x", padx=10, pady=5)
170156
ttk.Button(symbols_frame, text="Send '2 5 degC thunder'", command=lambda: send_symbols(devices), style="TButton").pack(side="left", padx=5, pady=5)
171157

172158
# PWM Frequency Combo Box
173-
pwm_freq_frame = ttk.LabelFrame(content_frame, text="PWM Frequency", style="TLabelframe")
159+
pwm_freq_frame = ttk.LabelFrame(root, text="PWM Frequency", style="TLabelframe")
174160
pwm_freq_frame.pack(fill="x", padx=10, pady=5)
175161
pwm_freq_combo = ttk.Combobox(pwm_freq_frame, values=PWM_FREQUENCIES, style="TCombobox")
176162
pwm_freq_combo.pack(fill="x", padx=5, pady=5)
177163
pwm_freq_combo.bind("<<ComboboxSelected>>", lambda: set_pwm_freq(devices, pwm_freq_combo.get()))
178164

179165
# Equalizer
180-
equalizer_frame = ttk.LabelFrame(content_frame, text="Equalizer", style="TLabelframe")
166+
equalizer_frame = ttk.LabelFrame(root, text="Equalizer", style="TLabelframe")
181167
equalizer_frame.pack(fill="x", padx=10, pady=5)
182168
ttk.Button(equalizer_frame, text="Start random equalizer", command=lambda: perform_action(devices, "start_eq"), style="TButton").pack(side="left", padx=5, pady=5)
183169
ttk.Button(equalizer_frame, text="Stop", command=stop_thread, style="TButton").pack(side="left", padx=5, pady=5)
184170

185-
# Update scroll region when frame size changes
186-
def configure_scroll_region(event):
187-
canvas.configure(scrollregion=canvas.bbox("all"))
188-
189-
content_frame.bind("<Configure>", configure_scroll_region)
190-
191-
# Bind mouse wheel to scroll
192-
def on_mousewheel(event):
193-
canvas.yview_scroll(int(-1*(event.delta/120)), "units")
194-
195-
canvas.bind_all("<MouseWheel>", on_mousewheel)
196-
197-
# Make canvas expand with window
198-
def on_canvas_configure(event):
199-
canvas.itemconfig(canvas_frame, width=event.width)
200-
201-
canvas.bind("<Configure>", on_canvas_configure)
202-
203171
root.mainloop()
204172

205173
def perform_action(devices, action):

0 commit comments

Comments
 (0)