play_holdem.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:learning-texas-holdem 作者: gjgregory 项目源码 文件源码
def _set_card_image(self, box, image, card):
        """Helper function to set card box's background color and image according to
        the specified image path."""
        #get appropriate color/image
        if card.rank == None:
            color = DARK_SLATE_BLUE
            img_path = FACE_DOWN
        else:
            color = GHOST_WHITE
            img_path = 'art_assets/' + RankStrings[card.rank] + SuitStrings[card.suit] + '.png'
        #change background color of widget
        box.modify_bg(gtk.STATE_NORMAL, color)
        #assign (presumably transparent) image to widget
        pixbuf = gtk.gdk.pixbuf_new_from_file(img_path)
        scaled_pixbuf = pixbuf.scale_simple(100, 150, gtk.gdk.INTERP_BILINEAR)
        image.set_from_pixbuf(scaled_pixbuf)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号