Skip to Content
Tkinter GUI Programming by Example
book

Tkinter GUI Programming by Example

by David Love
April 2018
Beginner content levelBeginner
340 pages
7h 54m
English
Packt Publishing
Content preview from Tkinter GUI Programming by Example

Choosing to stick

As you may remember from the previous chapters, when the player chooses to stick, the round is automatically over, and the winner needs to be determined by comparing the player's hand to the dealer's.

The method called by our stick button is that of the GameWindow itself. This method only passes on the stick choice to the GameScreen:

def stick(self):    self.game_screen.stick()

The GameScreen grabs the final state from our GameState, then performs the same steps as it did when we found a winner during our hit logic:

def stick(self):    table_state = self.game_state.calculate_final_state()    self.show_dealers_cards(table_state)    self.show_winner_text(table_state['has_winner'])    self.master.on_winner()

The final state is calculated ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

Bhaskar Chaudhary

Publisher Resources

ISBN: 9781788627481Supplemental Content