O'Reilly logo

Tkinter GUI Programming by Example by David Love

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required