43 lines
2.1 KiB
Python
Executable File
43 lines
2.1 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"""
|
|
common = dict(fg_color="white", hover_color="white", text_color="black", text_color_disabled="white", font=("Arial", 20))
|
|
self.hit_button = ctk.CTkButton(self.button_frame, text="Hit", command=self.gui._hit, **common)
|
|
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, **common)
|
|
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, **common)
|
|
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, **common)
|
|
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"""
|
|
for b in (self.hit_button, self.stand_button, self.double_button, self.split_button):
|
|
b.configure(fg_color="white", hover_color="white")
|
|
|
|
def _mark_button(self, button, is_correct):
|
|
"""Original button marking"""
|
|
color = "green" if is_correct else "red"
|
|
button.configure(fg_color=color, hover_color=color) |