@@ -46,7 +46,15 @@ def popup(message):
4646def run_gui (devices ):
4747 root = tk .Tk ()
4848 root .title ("LED Matrix Control" )
49- root .geometry ("400x900" )
49+
50+ tabControl = ttk .Notebook (root )
51+ tab1 = ttk .Frame (tabControl )
52+ tab2 = ttk .Frame (tabControl )
53+ tab3 = ttk .Frame (tabControl )
54+ tabControl .add (tab1 , text = "Home" )
55+ tabControl .add (tab2 , text = "Dynamic Controls" )
56+ tabControl .add (tab3 , text = "Advanced" )
57+ tabControl .pack (expand = 1 , fill = "both" )
5058
5159 # Configure dark theme
5260 style = ttk .Style ()
@@ -81,7 +89,7 @@ def run_gui(devices):
8189 device_checkboxes [dev .name ] = checkbox_var
8290
8391 # Device Control Buttons
84- device_control_frame = ttk .LabelFrame (root , text = "Device Control" , style = "TLabelframe" )
92+ device_control_frame = ttk .LabelFrame (tab1 , text = "Device Control" , style = "TLabelframe" )
8593 device_control_frame .pack (fill = "x" , padx = 10 , pady = 5 )
8694 control_buttons = {
8795 "Bootloader" : "bootloader" ,
@@ -92,15 +100,15 @@ def run_gui(devices):
92100 ttk .Button (device_control_frame , text = text , command = lambda a = action : perform_action (devices , a ), style = "TButton" ).pack (side = "left" , padx = 5 , pady = 5 )
93101
94102 # Brightness Slider
95- brightness_frame = ttk .LabelFrame (root , text = "Brightness" , style = "TLabelframe" )
103+ brightness_frame = ttk .LabelFrame (tab1 , text = "Brightness" , style = "TLabelframe" )
96104 brightness_frame .pack (fill = "x" , padx = 10 , pady = 5 )
97105 global brightness_scale
98106 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" )
99107 brightness_scale .set (120 ) # Default value
100108 brightness_scale .pack (fill = "x" , padx = 5 , pady = 5 )
101109
102110 # Animation Control
103- animation_frame = ttk .LabelFrame (root , text = "Animation" , style = "TLabelframe" )
111+ animation_frame = ttk .LabelFrame (tab1 , text = "Animation" , style = "TLabelframe" )
104112 animation_frame .pack (fill = "x" , padx = 10 , pady = 5 )
105113 animation_buttons = {
106114 "Start Animation" : "start_animation" ,
@@ -110,20 +118,20 @@ def run_gui(devices):
110118 ttk .Button (animation_frame , text = text , command = lambda a = action : perform_action (devices , a ), style = "TButton" ).pack (side = "left" , padx = 5 , pady = 5 )
111119
112120 # Pattern Combo Box
113- pattern_frame = ttk .LabelFrame (root , text = "Pattern" , style = "TLabelframe" )
121+ pattern_frame = ttk .LabelFrame (tab1 , text = "Pattern" , style = "TLabelframe" )
114122 pattern_frame .pack (fill = "x" , padx = 10 , pady = 5 )
115123 pattern_combo = ttk .Combobox (pattern_frame , values = PATTERNS , style = "TCombobox" )
116124 pattern_combo .pack (fill = "x" , padx = 5 , pady = 5 )
117125 pattern_combo .bind ("<<ComboboxSelected>>" , lambda event : set_pattern (devices , pattern_combo .get ()))
118126
119127 # Percentage Slider
120- percentage_frame = ttk .LabelFrame (root , text = "Fill screen X% (could be volume indicator)" , style = "TLabelframe" )
128+ percentage_frame = ttk .LabelFrame (tab1 , text = "Fill screen X% (could be volume indicator)" , style = "TLabelframe" )
121129 percentage_frame .pack (fill = "x" , padx = 10 , pady = 5 )
122130 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" )
123131 percentage_scale .pack (fill = "x" , padx = 5 , pady = 5 )
124132
125133 # Countdown Timer
126- countdown_frame = ttk .LabelFrame (root , text = "Countdown Timer" , style = "TLabelframe" )
134+ countdown_frame = ttk .LabelFrame (tab2 , text = "Countdown Timer" , style = "TLabelframe" )
127135 countdown_frame .pack (fill = "x" , padx = 10 , pady = 5 )
128136 countdown_spinbox = tk .Spinbox (countdown_frame , from_ = 1 , to = 60 , width = 5 , bg = "#2b2b2b" , fg = "white" , textvariable = tk .StringVar (value = 10 ))
129137 countdown_spinbox .pack (side = "left" , padx = 5 , pady = 5 )
@@ -132,38 +140,38 @@ def run_gui(devices):
132140 ttk .Button (countdown_frame , text = "Stop" , command = stop_thread , style = "TButton" ).pack (side = "left" , padx = 5 , pady = 5 )
133141
134142 # Black & White and Greyscale Images in same row
135- image_frame = ttk .LabelFrame (root , text = "Black&White Images / Greyscale Images" , style = "TLabelframe" )
143+ image_frame = ttk .LabelFrame (tab1 , text = "Black&White Images / Greyscale Images" , style = "TLabelframe" )
136144 image_frame .pack (fill = "x" , padx = 10 , pady = 5 )
137145 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 )
138146 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 )
139147
140148 # Display Current Time
141- time_frame = ttk .LabelFrame (root , text = "Display Current Time" , style = "TLabelframe" )
149+ time_frame = ttk .LabelFrame (tab2 , text = "Display Current Time" , style = "TLabelframe" )
142150 time_frame .pack (fill = "x" , padx = 10 , pady = 5 )
143151 ttk .Button (time_frame , text = "Start" , command = lambda : perform_action (devices , "start_time" ), style = "TButton" ).pack (side = "left" , padx = 5 , pady = 5 )
144152 ttk .Button (time_frame , text = "Stop" , command = stop_thread , style = "TButton" ).pack (side = "left" , padx = 5 , pady = 5 )
145153
146154 # Custom Text
147- custom_text_frame = ttk .LabelFrame (root , text = "Custom Text" , style = "TLabelframe" )
155+ custom_text_frame = ttk .LabelFrame (tab1 , text = "Custom Text" , style = "TLabelframe" )
148156 custom_text_frame .pack (fill = "x" , padx = 10 , pady = 5 )
149157 custom_text_entry = ttk .Entry (custom_text_frame , width = 20 , style = "TEntry" )
150158 custom_text_entry .pack (side = "left" , padx = 5 , pady = 5 )
151159 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 )
152160
153161 # Display Text with Symbols
154- symbols_frame = ttk .LabelFrame (root , text = "Display Text with Symbols" , style = "TLabelframe" )
162+ symbols_frame = ttk .LabelFrame (tab1 , text = "Display Text with Symbols" , style = "TLabelframe" )
155163 symbols_frame .pack (fill = "x" , padx = 10 , pady = 5 )
156164 ttk .Button (symbols_frame , text = "Send '2 5 degC thunder'" , command = lambda : send_symbols (devices ), style = "TButton" ).pack (side = "left" , padx = 5 , pady = 5 )
157165
158166 # PWM Frequency Combo Box
159- pwm_freq_frame = ttk .LabelFrame (root , text = "PWM Frequency" , style = "TLabelframe" )
167+ pwm_freq_frame = ttk .LabelFrame (tab3 , text = "PWM Frequency" , style = "TLabelframe" )
160168 pwm_freq_frame .pack (fill = "x" , padx = 10 , pady = 5 )
161169 pwm_freq_combo = ttk .Combobox (pwm_freq_frame , values = PWM_FREQUENCIES , style = "TCombobox" )
162170 pwm_freq_combo .pack (fill = "x" , padx = 5 , pady = 5 )
163171 pwm_freq_combo .bind ("<<ComboboxSelected>>" , lambda : set_pwm_freq (devices , pwm_freq_combo .get ()))
164172
165173 # Equalizer
166- equalizer_frame = ttk .LabelFrame (root , text = "Equalizer" , style = "TLabelframe" )
174+ equalizer_frame = ttk .LabelFrame (tab2 , text = "Equalizer" , style = "TLabelframe" )
167175 equalizer_frame .pack (fill = "x" , padx = 10 , pady = 5 )
168176 ttk .Button (equalizer_frame , text = "Start random equalizer" , command = lambda : perform_action (devices , "start_eq" ), style = "TButton" ).pack (side = "left" , padx = 5 , pady = 5 )
169177 ttk .Button (equalizer_frame , text = "Stop" , command = stop_thread , style = "TButton" ).pack (side = "left" , padx = 5 , pady = 5 )
0 commit comments