bug fixes

This commit is contained in:
Maik 2026-06-13 22:42:48 +02:00
parent f49dfe10e5
commit 16103310c0
3 changed files with 17 additions and 46 deletions

View File

@ -14,48 +14,14 @@ class ActionButtons:
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)
)
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,
fg_color="white",
text_color="black",
text_color_disabled="white",
font=("Arial", 20)
)
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,
fg_color="white",
text_color="black",
text_color_disabled="white",
font=("Arial", 20)
)
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,
fg_color="white",
text_color="black",
text_color_disabled="white",
font=("Arial", 20)
)
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):
@ -68,12 +34,10 @@ class ActionButtons:
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")
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)
button.configure(fg_color=color, hover_color=color)

View File

@ -38,6 +38,7 @@ class BlackjackGUI:
text="Hint",
command=self.show_hint,
fg_color="white",
hover_color="white",
text_color="black",
font=("Arial", 20)
)
@ -59,6 +60,7 @@ class BlackjackGUI:
text="Next Round",
command=self.start_new_round,
fg_color="white",
hover_color="white",
text_color="black",
font=("Arial", 20)
)

View File

@ -169,8 +169,13 @@ async function startRound(){
enableActions(false);
btnNext.disabled=false;
}
if(d.can_split){btnSplit.disabled=false}
else{btnSplit.disabled=true}
if(d.can_split){
btnSplit.disabled=false;
if(!d.has_blackjack){
feedback.textContent='You have a pair! Consider splitting.';
feedback.style.color='white';
}
}else{btnSplit.disabled=true}
}catch(e){feedback.textContent='Error connecting to server';feedback.style.color='red'}
}