當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。