Exemple #1
0
 def add_to_hand(self, card):
     assert type(card) == Card, (
     "{} (a {}) must be a Card!".format(card, type(card)))
     self._send_lock.acquire()
     card_image = CardImage.make_card_image(card.rank, card.suit)
     # So it is not garbage collected
     self.card_images.add(card_image)
     card_button = Tkinter.Button(self.frame)
     card_button.config(command=lambda card=card: self.send_card(card),
                        image=card_image)
     self.cards.update({card: card_button})
     self._send_lock.release()
Exemple #2
0
    def update_top_card(self):
        # Clubs has a black border
        card = self.Client.pile.top_card
        if not card.rank and not card.suit:
            image = CardImage.get_blank_card("Clubs")
            self.top_card_image = CardImage.prepare_for_tkinter(image)
        else:
            rank, suit = (self.Client.pile.top_card.rank,
                         self.Client.pile.top_card.suit)
            self.top_card_image = CardImage.make_card_image(rank, suit)

        self.top_card = Tkinter.Button(self, image=self.top_card_image)
        self.top_card.grid()