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


Python Spider.load_internet_image方法代码示例

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


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

示例1: TeamInfoFrame

# 需要导入模块: from spider import Spider [as 别名]
# 或者: from spider.Spider import load_internet_image [as 别名]
class TeamInfoFrame():
    def __init__(self, master, team_id):
        self.team_info_win = Toplevel(master)
        self.team_info_win.resizable(False, False)
        self.team_id = team_id

        self.spider = Spider()
        team_info_data = self.spider.load_team_info(team_id)

        analyzer = Analyzer()
        self.team_info = analyzer.analyze_team_info(team_info_data)
        (self.team_average, self.team_leader) = analyzer.analyze_team_data_leader(team_info_data)

        self.team_info_win.title(self.team_info.name)

        self.load_team_introduction()
        self.load_team_data()
        self.load_players()

    def load_team_introduction(self):
        team_frame = LabelFrame(self.team_info_win, text=self.team_info.name)
        team_frame.grid(row=0, column=0, columnspan=5, padx=5, pady=5)

        team_logo_image = utils.load_team_logo(self.team_id)
        team_logo = Label(team_frame, image=team_logo_image)
        team_logo.grid(row=0, column=0, rowspan=2, padx=5, pady=5)
        team_logo.image = team_logo_image

        Label(team_frame, text=self.team_info.introduction[0], width=30).grid(row=0, column=1, sticky=W, padx=5, pady=5)
        Label(team_frame, text=self.team_info.introduction[1], width=30).grid(row=0, column=2, sticky=W, padx=5, pady=5)
        Label(team_frame, text=self.team_info.introduction[2], width=30).grid(row=0, column=3, sticky=W, padx=5, pady=5)
        Label(team_frame, text=self.team_info.introduction[3], width=30).grid(row=1, column=1, sticky=W, padx=5, pady=5)
        Label(team_frame, text=self.team_info.introduction[4], width=30).grid(row=1, column=2, sticky=W, padx=5, pady=5)
        Label(team_frame, text=self.team_info.introduction[5], width=30).grid(row=1, column=3, sticky=W, padx=5, pady=5)

    def load_team_data(self):
        self.load_points_frame()
        self.load_assists_frame()
        self.load_rebounds_frame()
        self.load_steal_frame()
        self.load_block_frame()
        
        '''team_average_frame = LabelFrame(self.team_info_win)
        team_average_frame.grid(row=1, column=0, padx=5, pady=5)
        Label(team_average_frame, text=self.team_average[0][0] + self.team_average[0][1] + '\n' + self.team_average[0][2]).grid(row=0, column=0)
        Label(team_average_frame, text=self.team_average[1][0] + self.team_average[1][1] + '\n' + self.team_average[1][2]).grid(row=0, column=1)
        Label(team_average_frame, text=self.team_average[2][0] + self.team_average[2][1] + '\n' + self.team_average[2][2]).grid(row=0, column=2)
        Label(team_average_frame, text=self.team_average[3][0] + self.team_average[3][1] + '\n' + self.team_average[3][2]).grid(row=0, column=3)
        Label(team_average_frame, text=self.team_average[4][0] + self.team_average[4][1] + '\n' + self.team_average[4][2]).grid(row=0, column=4)

        team_leader_frame = LabelFrame(self.team_info_win)
        team_leader_frame.grid(row=2, column=0, padx=5, pady=5)
        Label(team_leader_frame, text=self.team_leader[0][0] + '\n' + self.team_leader[0][1] + '\n' + self.team_leader[0][2]).grid(row=1, column=0)
        Label(team_leader_frame, text=self.team_leader[1][0] + '\n' + self.team_leader[1][1] + '\n' + self.team_leader[1][2]).grid(row=1, column=1)
        Label(team_leader_frame, text=self.team_leader[2][0] + '\n' + self.team_leader[2][1] + '\n' + self.team_leader[2][2]).grid(row=1, column=2)
        Label(team_leader_frame, text=self.team_leader[3][0] + '\n' + self.team_leader[3][1] + '\n' + self.team_leader[3][2]).grid(row=1, column=3)
        Label(team_leader_frame, text=self.team_leader[4][0] + '\n' + self.team_leader[4][1] + '\n' + self.team_leader[4][2]).grid(row=1, column=4)'''

    def load_points_frame(self):
        points_frame = LabelFrame(self.team_info_win, text='得分')
        points_frame.grid(row=1, column=0, padx=5, pady=5)

        # 球队得分
        Label(points_frame, text=self.team_average[0][0] + self.team_average[0][1] + '\n' + self.team_average[0][2]).grid(row=0, column=0, columnspan=2, padx=5, pady=5)

        # 个人得分
        image = self.spider.load_internet_image(self.team_leader[0][0])
        image_label = Label(points_frame, image=image)
        image_label.grid(row=1, column=0, sticky=W, padx=5, pady=5)
        image_label.image = image
        Label(points_frame, text=self.team_leader[0][1] + '\n' + self.team_leader[0][2] + '\n' + self.team_leader[0][3]).grid(row=1, column=1, sticky=W, padx=5, pady=5)

    def load_assists_frame(self):
        assists_frame = LabelFrame(self.team_info_win, text='助攻')
        assists_frame.grid(row=1, column=1, padx=5, pady=5)

        Label(assists_frame, text=self.team_average[1][0] + self.team_average[1][1] + '\n' + self.team_average[1][2]).grid(row=0, column=0, columnspan=2, padx=5, pady=5)

        image = self.spider.load_internet_image(self.team_leader[1][0])
        image_label = Label(assists_frame, image=image)
        image_label.grid(row=1, column=0, sticky=W, padx=5, pady=5)
        image_label.image = image
        Label(assists_frame, text=self.team_leader[1][1] + '\n' + self.team_leader[1][2] + '\n' + self.team_leader[1][3]).grid(row=1, column=1, sticky=W, padx=5, pady=5)

    def load_rebounds_frame(self):
        rebounds_frame = LabelFrame(self.team_info_win, text='篮板')
        rebounds_frame.grid(row=1, column=2, padx=5, pady=5)

        Label(rebounds_frame, text=self.team_average[2][0] + self.team_average[2][1] + '\n' + self.team_average[2][2]).grid(row=0, column=0, columnspan=2, padx=5, pady=5)

        image = self.spider.load_internet_image(self.team_leader[2][0])
        image_label = Label(rebounds_frame, image=image)
        image_label.grid(row=1, column=0, sticky=W, padx=5, pady=5)
        image_label.image = image
        Label(rebounds_frame, text=self.team_leader[2][1] + '\n' + self.team_leader[2][2] + '\n' + self.team_leader[2][3]).grid(row=1, column=1, sticky=W, padx=5, pady=5)
        
    def load_steal_frame(self):
        steal_frame = LabelFrame(self.team_info_win, text='抢断')
        steal_frame.grid(row=1, column=3, padx=5, pady=5)

#.........这里部分代码省略.........
开发者ID:Yuanlimakefun,项目名称:NBATeams,代码行数:103,代码来源:team_info_frame.py


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