live_scoreboard.py 文件源码

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

项目:live_scoreboard 作者: ClysmiC 项目源码 文件源码
def update(self):
        self.canvas.delete("updates")
        self.show()

        if self.game["status"] == "Pre":
            topString = "{:3s} @ {:3s}".format(self.game["away"]["name"], self.game["home"]["name"])

            ast = self.game["adjustedStartTime"]


            if TWENTY_FOUR_HOUR_CLOCK:
                botString = "{:s} {:d}, {:02d}:{:02d}".format(months[ast.month], ast.day, ast.hour, ast.minute)
            else:
                hour, suffix = toTwelveHourClock(ast)
                botString = "{:s} {:d}, {:02d}:{:02d} {:s}".format(months[ast.month], ast.day, hour, ast.minute, suffix)


            awayLogo = self.scaledLogos[self.game["away"]["name"]]
            homeLogo = self.scaledLogos[self.game["home"]["name"]]

            # Center logo
            awayLogoXOffset = (self.awayLogoRegion.width - awayLogo.width()) // 2
            awayLogoYOffset = (self.awayLogoRegion.height - awayLogo.height()) // 2

            homeLogoXOffset = (self.homeLogoRegion.width - homeLogo.width()) // 2
            homeLogoYOffset = (self.homeLogoRegion.height - homeLogo.height()) // 2

            lineY = self.lineYStart

            self.canvas.create_image((self.awayLogoRegion.left + awayLogoXOffset, self.awayLogoRegion.top + awayLogoYOffset), anchor=tk.NW, image=awayLogo, tags="updates")
            self.canvas.create_image((self.homeLogoRegion.left + homeLogoXOffset, self.homeLogoRegion.top + homeLogoYOffset), anchor=tk.NW, image=homeLogo, tags="updates")

            self.canvas.create_text((self.topX, lineY), anchor=tk.NW, text=topString, font=self.font, fill=fontColor, tags="updates")

            lineY += self.lineHeight

            self.canvas.create_text((self.botX, lineY), anchor=tk.NW, text=botString, font=self.font, fill=fontColor, tags="updates")
        else:
            self.canvas.create_text((self.width // 2, self.height //2), anchor=tk.CENTER, text="No games found...", font=self.font, fill=fontColor, tags="updates")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号