当前位置: 首页>>代码示例>>Python>>正文


Python Card.valueSuitFromCard方法代码示例

本文整理汇总了Python中Card.valueSuitFromCard方法的典型用法代码示例。如果您正苦于以下问题:Python Card.valueSuitFromCard方法的具体用法?Python Card.valueSuitFromCard怎么用?Python Card.valueSuitFromCard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Card的用法示例。


在下文中一共展示了Card.valueSuitFromCard方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_hero_cards

# 需要导入模块: import Card [as 别名]
# 或者: from Card import valueSuitFromCard [as 别名]
    def get_hero_cards(self, hero, cards):
        """Formats the hero cards for inclusion in the tree."""
        trans = ('0', 'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A')
        if hero == '':
            return "xxxxxx"
        else:
#    find the hero's seat from the stat_dict
            for stat in self.parent.hud.stat_dict.itervalues():
                if stat['screen_name'] == hero:
                    return Card.valueSuitFromCard(self.parent.hud.cards[stat['seat']][0]) +\
                           Card.valueSuitFromCard(self.parent.hud.cards[stat['seat']][1]) +\
                           Card.valueSuitFromCard(self.parent.hud.cards[stat['seat']][2])
        return "xxxxxx"
开发者ID:Fulvio75,项目名称:fpdb,代码行数:15,代码来源:Mucked.py

示例2: update_contents

# 需要导入模块: import Card [as 别名]
# 或者: from Card import valueSuitFromCard [as 别名]
    def update_contents(self, container, i):

        if not self.hud.cards.has_key(i): return
        
        cards = self.hud.cards[i]
        # Here we want to know how many cards the given seat showed;
        # board is considered a seat, and has the id 'common'
        # 'cards' on the other hand is a tuple. The format is:
        # (card_num, card_num, ...)
        n_cards = valid_cards(cards)
        if n_cards > 1:
#    scratch is a working pixbuf, used to assemble the image
            scratch = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
                                        has_alpha=True, bits_per_sample=8,
                                        width=int(self.card_width)*n_cards,
                                        height=int(self.card_height))
            x = 0 # x coord where the next card starts in scratch
            for card in cards:
#    concatenate each card image to scratch
                # flop game never(?) has unknown cards.
                # FIXME: if "show one and fold" ever becomes an option,
                # this needs to be changed
                if card == None or card ==0:
                    break

                # This gives us the card symbol again
                (_rank, _suit) = Card.valueSuitFromCard(card)
                _rank = Card.card_map[_rank]
                # We copy the image data. Technically we __could__ use
                # the pixmap directly but it seems there are some subtle
                # races and explicitly creating a new pixbuf seems to
                # work around most of them.
                #
                # We also should not use copy_area() but it is far
                # easier to work with than _render_to_drawable()
                px = self.card_images[_suit][_rank].copy()
                px.copy_area(0, 0,
                        px.get_width(), px.get_height(),
                        scratch, x, 0)
                x += px.get_width()
                
            if container is not None:
                container.seen_cards.set_from_pixbuf(scratch)
                container.resize(1,1)
                container.move(self.positions[i][0] + self.hud.table.x,
                            self.positions[i][1] + self.hud.table.y)   # here is where I move back
                container.show()

            self.displayed = True
            if i != "common":
                id = self.get_id_from_seat(i)
                # sc: had KeyError here with new table so added id != None test as a guess:
                if id is not None:
                    self.m_windows[i].eb.set_tooltip_text(self.hud.stat_dict[id]['screen_name'])
开发者ID:Fulvio75,项目名称:fpdb,代码行数:56,代码来源:Mucked.py

示例3: update_gui

# 需要导入模块: import Card [as 别名]
# 或者: from Card import valueSuitFromCard [as 别名]
    def update_gui(self, new_hand_id):
        self.clear()
        for c, cards in self.parent.hud.cards.iteritems():
            if c == 'common': continue
            self.grid_contents[(1, c - 1)].set_text(self.get_screen_name(c))
            for i in ((0, cards[0]), (1, cards[1]), (2, cards[2]), (3, cards[3]), 
                      (4, cards[4]), (5, cards[5]), (6, cards[6])):
                if not i[1] == 0:
                    # Pixmaps are stored in dict with rank+suit keys
                    (_rank, _suit) = Card.valueSuitFromCard(i[1])
                    _rank = Card.card_map[_rank]
                    px = self.card_images[_suit][_rank].copy()
                    self.seen_cards[(i[0], c - 1)].set_from_pixbuf(px)
##    action in tool tips for 3rd street cards
        for c in (0, 1, 2):
            for r in range(0, self.rows):
                #self.eb[(c, r)].set_tooltip_text(self.tips[0])
                pass

#    action in tools tips for later streets
        round_to_col = (0, 3, 4, 5, 6)
开发者ID:Fulvio75,项目名称:fpdb,代码行数:23,代码来源:Mucked.py

示例4: process_result_value

# 需要导入模块: import Card [as 别名]
# 或者: from Card import valueSuitFromCard [as 别名]
 def process_result_value(self, value, dialect):
     return Card.valueSuitFromCard( value )
开发者ID:sigmike,项目名称:fpdb,代码行数:4,代码来源:AlchemyFacilities.py


注:本文中的Card.valueSuitFromCard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。