本文整理汇总了Python中gui.Gui.mainMenu方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.mainMenu方法的具体用法?Python Gui.mainMenu怎么用?Python Gui.mainMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.Gui
的用法示例。
在下文中一共展示了Gui.mainMenu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import mainMenu [as 别名]
class Game():
'''A class containing all major elements of the game engine. GUI, input, draw functions, current state, save/load,
AI, map functions, as well as settings.'''
def __init__(self):
'''Initializes the Game class.'''
self.clock = pygame.time.Clock()
# Initialize display, state
self.display, self.state = Display(), State(self)
# Initialize GUI and scene
self.gui, self.scene = Gui(self), Scene(self)
# Initialize input
self.input = Input(self)
self.gui.mainMenu()
def events(self):
'''Handles events such as input, but also ingame events which raise dialogs.'''
# Iterate over new events
for event in pygame.event.get():
# Quit
if event.type == pygame.QUIT:
sys.exit()
else:
self.input.handle(event)
def update(self):
'''Goes through updates on the game engine and manages time.
:return:
'''
# Update each sprite group.
self.gui.widgets.update()
self.scene.sprites.update()
# Refresh pygame's event list.
pygame.event.pump()
# Keep framerate at 30 fps.
self.clock.tick(30)
def draw(self):
'''Send current sprites to be drawn on the display.'''
self.display.draw(self.gui.widgets, self.scene.sprites)