feature/start-screen-and-stats-screen #2
@ -14,48 +14,14 @@ class ActionButtons:
|
|||||||
|
|
||||||
def _create_action_buttons(self):
|
def _create_action_buttons(self):
|
||||||
"""Replicates original button creation exactly"""
|
"""Replicates original button creation exactly"""
|
||||||
self.hit_button = ctk.CTkButton(
|
common = dict(fg_color="white", hover_color="white", text_color="black", text_color_disabled="white", font=("Arial", 20))
|
||||||
self.button_frame,
|
self.hit_button = ctk.CTkButton(self.button_frame, text="Hit", command=self.gui._hit, **common)
|
||||||
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.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 = 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.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 = 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.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 = 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)
|
self.split_button.grid(row=1, column=1, padx=10, pady=10)
|
||||||
|
|
||||||
def _enable_action_buttons(self, enable):
|
def _enable_action_buttons(self, enable):
|
||||||
@ -68,12 +34,10 @@ class ActionButtons:
|
|||||||
|
|
||||||
def _reset_button_colors(self):
|
def _reset_button_colors(self):
|
||||||
"""Original color reset"""
|
"""Original color reset"""
|
||||||
self.hit_button.configure(fg_color="white")
|
for b in (self.hit_button, self.stand_button, self.double_button, self.split_button):
|
||||||
self.stand_button.configure(fg_color="white")
|
b.configure(fg_color="white", hover_color="white")
|
||||||
self.double_button.configure(fg_color="white")
|
|
||||||
self.split_button.configure(fg_color="white")
|
|
||||||
|
|
||||||
def _mark_button(self, button, is_correct):
|
def _mark_button(self, button, is_correct):
|
||||||
"""Original button marking"""
|
"""Original button marking"""
|
||||||
color = "green" if is_correct else "red"
|
color = "green" if is_correct else "red"
|
||||||
button.configure(fg_color=color)
|
button.configure(fg_color=color, hover_color=color)
|
||||||
@ -38,6 +38,7 @@ class BlackjackGUI:
|
|||||||
text="Hint",
|
text="Hint",
|
||||||
command=self.show_hint,
|
command=self.show_hint,
|
||||||
fg_color="white",
|
fg_color="white",
|
||||||
|
hover_color="white",
|
||||||
text_color="black",
|
text_color="black",
|
||||||
font=("Arial", 20)
|
font=("Arial", 20)
|
||||||
)
|
)
|
||||||
@ -59,6 +60,7 @@ class BlackjackGUI:
|
|||||||
text="Next Round",
|
text="Next Round",
|
||||||
command=self.start_new_round,
|
command=self.start_new_round,
|
||||||
fg_color="white",
|
fg_color="white",
|
||||||
|
hover_color="white",
|
||||||
text_color="black",
|
text_color="black",
|
||||||
font=("Arial", 20)
|
font=("Arial", 20)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -169,8 +169,13 @@ async function startRound(){
|
|||||||
enableActions(false);
|
enableActions(false);
|
||||||
btnNext.disabled=false;
|
btnNext.disabled=false;
|
||||||
}
|
}
|
||||||
if(d.can_split){btnSplit.disabled=false}
|
if(d.can_split){
|
||||||
else{btnSplit.disabled=true}
|
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'}
|
}catch(e){feedback.textContent='Error connecting to server';feedback.style.color='red'}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user