本文整理汇总了Python中Menu.main方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.main方法的具体用法?Python Menu.main怎么用?Python Menu.main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu.main方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: winner
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import main [as 别名]
def winner(name):
pygame.init()
pygame.mixer.music.load("sounds/winscreen.mp3")
pygame.mixer.music.play(-1)
screen = pygame.display.get_surface()
screen = pygame.display.set_mode((800, 600), pygame.RESIZABLE)
level = pygame.image.load("background/winScreen.jpg").convert()
levelRect = level.get_rect(center=(400, 300))
screen.blit(level, (0, 0))
myfont = pygame.font.Font("fonts/moonhouse.ttf", 50)
winner = name + " Wins!!!"
label = myfont.render(winner, 1, (0, 255, 0))
textpos = label.get_rect()
textpos.centerx = level.get_rect().centerx
textpos.centery = level.get_rect().centery
while 1:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
keypressed = pygame.key.name(event.key)
if keypressed == pygame.key.name(pygame.K_ESCAPE):
Menu.main()
sys.exit(0)
screen.blit(level, (0,0))
screen.blit(label, textpos)
pygame.display.flip()
示例2: main
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import main [as 别名]
def main():
global LEFTTURN,RIGHTTURN,THRUST,FIRE,PSDDENSITY,LIGHT,THRUSTOCCLUDE,TURNOCCLUDE,EXPLODEOCCLUDE,BULLETOCCLUDE,MUSICVOLUME,FXVOLUME
while True:
LEFTTURN,RIGHTTURN,THRUST,FIRE,PSDDENSITY,LIGHT,THRUSTOCCLUDE,TURNOCCLUDE,EXPLODEOCCLUDE,BULLETOCCLUDE,MUSICVOLUME,FXVOLUME = Menu.main()
Init()
while True:
ToDo = GetInput()
if ToDo == "Return to Menu":break
Update()
Move()
ToDo = CollisionDetect()
if ToDo == "Return to Menu":break
Draw()
Clock.tick(40)
MusicChannel.stop()