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