本文整理匯總了Python中graphics.Graphics.renderMenu方法的典型用法代碼示例。如果您正苦於以下問題:Python Graphics.renderMenu方法的具體用法?Python Graphics.renderMenu怎麽用?Python Graphics.renderMenu使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類graphics.Graphics
的用法示例。
在下文中一共展示了Graphics.renderMenu方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Go
# 需要導入模塊: from graphics import Graphics [as 別名]
# 或者: from graphics.Graphics import renderMenu [as 別名]
class Go(object):
def main(self, selection, args=None):
self.graphics = Graphics()
try:
self.graphics.start()
while True:
if selection == 'quit':
break
if selection == 'play':
selection, args = self.playGame(args)
if selection == 'game over':
selection, args = self.gameOver(args)
if selection == 'menu':
selection, args = self.menu()
finally:
self.graphics.cleanUp()
def playGame(self, args):
board = Board(args)
blackTurn = True
message = ''
passed = False
while True:
move = self.graphics.getTurn(board, blackTurn, message)
if move == 'pass':
if passed:
return 'game over', board
blackTurn = not blackTurn
message = ''
passed = True
else:
result = board.makeMove(move, blackTurn)
if result == 'success':
blackTurn = not blackTurn
message = ''
passed = False
else:
message = result
def gameOver(self, args):
return self.graphics.gameOver(args)
def menu(self):
return self.graphics.renderMenu()