Our GameScreen will be a subclass from Tkinter's powerful Canvas widget and contain all of the logic to do with our window's graphics and animations:
class GameScreen(tk.Canvas): def __init__(self, master, **kwargs): super().__init__(master, **kwargs) self.DECK_COORDINATES = (700, 100) self.CARD_ORIGINAL_POSITION = 100 self.CARD_WIDTH_OFFSET = 100 self.PLAYER_CARD_HEIGHT = 300 self.DEALER_CARD_HEIGHT = 100 self.PLAYER_SCORE_TEXT_COORDS = (340, 450) self.PLAYER_MONEY_COORDS = (490, 450) self.POT_MONEY_COORDS = (500, 100) self.WINNER_TEXT_COORDS = (400, 250)
We begin by initializing the super class, Canvas, with the arguments passed over by our GameWindow. We use the **kwargs argument to pass all of our options over to ...