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


Python Stopwatch.secToMin方法代码示例

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


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

示例1: loadLevel

# 需要导入模块: from stopwatch import Stopwatch [as 别名]
# 或者: from stopwatch.Stopwatch import secToMin [as 别名]
 def loadLevel(self):
     terrain, self.startpos = self.maps.load(self.level)
     self.terrain = pygame.sprite.Group(*terrain)
     self.ball = Ball(*self.startpos)
     self.score = 0
     self.stopwatch.restart()
     if self.level != "test":
         highscore = self.progress[self.level]["score"]
         bestTime = self.progress[self.level]["time"]
     else:
         highscore, bestTime = None, None
     self.highscoreText = str(highscore) if highscore != None else "---"
     if bestTime != None:
         self.bestTimeText = Stopwatch.secToMin(bestTime)
     else:
         self.bestTimeText = "---"
开发者ID:daniel-wen,项目名称:bouncier,代码行数:18,代码来源:main.py

示例2: initLevelMenu

# 需要导入模块: from stopwatch import Stopwatch [as 别名]
# 或者: from stopwatch.Stopwatch import secToMin [as 别名]
 def initLevelMenu(self):
     top = 60
     left = 130
     entries = []
     actions = []
     for i, level in enumerate(self.maps.levels):
         prevLevel = self.maps.levels[i - 1]
         if i > 0 and self.progress[prevLevel]["score"] == None:
             entries.append("Level %s    Locked" % level)
             actions.append(None)
             continue
         elif self.progress[level]["score"] == None:
             entries.append("Level %s    Unlocked" % level)
         else:
             entries.append("Level %s    Highscore: %d    Best time: %s" %
                 (level, self.progress[level]["score"],
                     Stopwatch.secToMin(self.progress[level]["time"])))
         # Locally scope level
         actions.append(lambda level=level: self.playLevel(level))
     entries += ["Return to main menu", "Clear progress"]
     actions += [self.doMainMenu, self.progress.clear]
     self.levelMenu = Menu(left, top, entries, actions)
开发者ID:daniel-wen,项目名称:bouncier,代码行数:24,代码来源:main.py


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