本文整理汇总了Python中Menu.isActive方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.isActive方法的具体用法?Python Menu.isActive怎么用?Python Menu.isActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu.isActive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import isActive [as 别名]
def main():
# pygame initialization
pygame.init()
pygame.mixer.music.load('sounds/menu.mp3')
pygame.mixer.music.play(-1)
pygame.display.set_caption('PyFighters')
pygame.mouse.set_visible(1)
clock = pygame.time.Clock()
# code for our menu
ourMenu = ("Play Online",
"How to play",
"Statistics",
"Exit")
myMenu = Menu(ourMenu)
myMenu.drawMenu()
pygame.display.flip()
# main loop for event handling and drawing
while 1:
clock.tick(60)
# Handle Input Events
for event in pygame.event.get():
myMenu.handleEvent(event)
# quit the game if escape is pressed
if event.type == QUIT:
sys.exit(0)
elif event.type == Menu.MENUCLICKEDEVENT:
if event.text == "Play Online":
time.sleep(1)
character = CharSelect.charselect()
print "Just Waiting..."
InitScript.main(socketInit(), character)
elif event.text == "How to play":
Settings.settings()
elif event.text == "Local Play":
Script.main()
elif event.text == "Exit":
sys.exit(0)
elif event.type == KEYDOWN and event.key == K_ESCAPE:
myMenu.activate()
sys.exit(0)
if myMenu.isActive():
myMenu.drawMenu()
pygame.display.flip()