Skip to content

Commit 5440e25

Browse files
committed
python: Rearrange game of life buttons in a grid
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 7fb179f commit 5440e25

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

python/inputmodule/gui/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,23 @@ def run_gui(devices):
119119
gol_frame = ttk.LabelFrame(tab_games, text="Game of Life", style="TLabelframe")
120120
gol_frame.pack(fill="x", padx=10, pady=5)
121121
animation_buttons = {
122-
"Current Matrix": "gol_current",
122+
"Current": "gol_current",
123123
"Pattern 1": "gol_pattern1",
124124
"Blinker": "gol_blinker",
125125
"Toad": "gol_toad",
126126
"Beacon": "gol_beacon",
127127
"Glider": "gol_glider",
128128
"Stop": "game_stop",
129129
}
130-
for text, action in animation_buttons.items():
131-
ttk.Button(gol_frame, text=text, command=lambda a=action: perform_action(devices, a), style="TButton").pack(side="left", padx=5, pady=5)
130+
for (i, (text, action)) in enumerate(animation_buttons.items()):
131+
# Organize in columns of three
132+
row = int(i / 3)
133+
column = i % 3
134+
if action == "game_stop":
135+
column = 0
136+
row += 1
137+
btn = ttk.Button(gol_frame, text=text, command=lambda a=action: perform_action(devices, a), style="TButton")
138+
btn.grid(row=row, column=column)
132139

133140
# Countdown Timer
134141
countdown_frame = ttk.LabelFrame(tab2, text="Countdown Timer", style="TLabelframe")

0 commit comments

Comments
 (0)