79 lines
2.7 KiB
Python
Executable File
79 lines
2.7 KiB
Python
Executable File
import customtkinter as ctk
|
|
|
|
class ActionButtons:
|
|
def __init__(self, parent, gui):
|
|
self.parent = parent
|
|
self.gui = gui # Reference to main GUI for callbacks
|
|
self._create_button_frame()
|
|
self._create_action_buttons()
|
|
|
|
def _create_button_frame(self):
|
|
"""Matches original button frame creation"""
|
|
self.button_frame = ctk.CTkFrame(self.parent)
|
|
self.button_frame.pack(pady=10)
|
|
|
|
def _create_action_buttons(self):
|
|
"""Replicates original button creation exactly"""
|
|
self.hit_button = ctk.CTkButton(
|
|
self.button_frame,
|
|
text="Hit",
|
|
command=self.gui._hit,
|
|
fg_color="white",
|
|
text_color="black",
|
|
text_color_disabled="white",
|
|
font=("Arial", 20)
|
|
)
|
|
self.hit_button.grid(row=0, column=0, padx=10, pady=10)
|
|
|
|
self.stand_button = ctk.CTkButton(
|
|
self.button_frame,
|
|
text="Stand",
|
|
command=self.gui._stand,
|
|
fg_color="white",
|
|
text_color="black",
|
|
text_color_disabled="white",
|
|
font=("Arial", 20)
|
|
)
|
|
self.stand_button.grid(row=0, column=1, padx=10, pady=10)
|
|
|
|
self.double_button = ctk.CTkButton(
|
|
self.button_frame,
|
|
text="Double",
|
|
command=self.gui._double,
|
|
fg_color="white",
|
|
text_color="black",
|
|
text_color_disabled="white",
|
|
font=("Arial", 20)
|
|
)
|
|
self.double_button.grid(row=1, column=0, padx=10, pady=10)
|
|
|
|
self.split_button = ctk.CTkButton(
|
|
self.button_frame,
|
|
text="Split",
|
|
command=self.gui._split,
|
|
fg_color="white",
|
|
text_color="black",
|
|
text_color_disabled="white",
|
|
font=("Arial", 20)
|
|
)
|
|
self.split_button.grid(row=1, column=1, padx=10, pady=10)
|
|
|
|
def _enable_action_buttons(self, enable):
|
|
"""Original enable/disable functionality"""
|
|
state = "normal" if enable else "disabled"
|
|
self.hit_button.configure(state=state)
|
|
self.stand_button.configure(state=state)
|
|
self.double_button.configure(state=state)
|
|
self.split_button.configure(state=state)
|
|
|
|
def _reset_button_colors(self):
|
|
"""Original color reset"""
|
|
self.hit_button.configure(fg_color="white")
|
|
self.stand_button.configure(fg_color="white")
|
|
self.double_button.configure(fg_color="white")
|
|
self.split_button.configure(fg_color="white")
|
|
|
|
def _mark_button(self, button, is_correct):
|
|
"""Original button marking"""
|
|
color = "green" if is_correct else "red"
|
|
button.configure(fg_color=color) |