コード例 #1
0
ファイル: Stack.py プロジェクト: Timidger/Mao
    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()
コード例 #2
0
ファイル: Deck.py プロジェクト: Timidger/Mao
 def __init__(self, master, Client):
     super(Deck, self).__init__(master)
     self.Client = Client
     self.grid()
     self.deck = Tkinter.Button(self)
     self.image = CardImage.get_back_image()
     self.deck.config(relief = 'flat',
                      command = lambda: self.Client.send(Card(None, None
                      )),
                      image=self.image)
     self.deck.grid()
コード例 #3
0
ファイル: Hand.py プロジェクト: Timidger/Mao
 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()