Choosing to hit

When the player decides to click the hit button, the GameWindow's hit method is called. This simply passes over to the GameScreen class to handle playing the deal animation:

def hit(self):    self.game_screen.hit()

The hit method on our GameScreen needs to set up for the deal animation in much the same way as it did when displaying the initial table:

def hit(self):    self.master.remove_all_buttons()    new_card = self.game_state.draw()    card_number = len(self.game_state.player.hand.cards)    image_pos = self.get_player_card_pos(card_number)    self.cards_to_deal_images.append(new_card.get_file())    self.cards_to_deal_positions.append(image_pos)    self.play_deal_animation()    while self.playing_animation:        self.master.update()

Before playing our ...

Get Tkinter GUI Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.