本文整理汇总了Python中Menu.show方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.show方法的具体用法?Python Menu.show怎么用?Python Menu.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu.show方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import show [as 别名]
def init():
#interaction clavier
tty.setcbreak(sys.stdin.fileno())
#cacher le curseur
os.system('setterm -cursor off')
Menu.setCurrentWindow(menu, "mainMenu")
Menu.show(menu)
示例2: run
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import show [as 别名]
def run():
n = 0
gameState = "run"
global game, menu, refresh
while True:
interact()
if Menu.gameWindow(menu):
gameState = Game.run(game, dt)
if gameState == "run":
if(n % 10):
#effacer la console
#sys.stdout.write("\033[2J")
Menu.show(menu)
Game.show(game)
elif gameState == "lose":
Menu.setCurrentWindow(menu, "lose")
Menu.show(menu)
gameState = "run"
elif gameState == "win":
Menu.setCurrentWindow(menu, "win")
Menu.show(menu)
gameState = "run"
else:
if refresh==True:
Menu.show(menu)
time.sleep(dt)
n += 1
示例3: show
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import show [as 别名]
def show(game):
if Game.getState(game) == 'menu':
Menu.show(game)
elif Game.getState(game) == 'game':
Game.show(game)
return
示例4: Application
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import show [as 别名]
class Application (DirectObject):
def __init__(self):
#-----------------------------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------VARIABLE DECLARATION------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------------------------------------------
self.menu = None
self.game = None
self.ins = None
self.creditsActivated = False
#-----------------------------------------------------------------------------------------------------------------------------------------------
#--------------------------------------------------------------APPLICATION INIT-----------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------------------------------------------
# Window configuration
props = WindowProperties( )
props.setTitle( 'Glooveth' )
props.setIconFilename("./icon.ico")
base.win.requestProperties( props )
# World configuration
base.disableMouse()
self.accept("escape", self.quit)
# Background
self.background = Image()
self.back = []
self.back.append(self.background.loadModel("./models/Background.egg", "./tex/back.png", 34, 0, 60 , 56))
self.back.append(self.background.loadModel("./models/Background.egg", "./tex/back2.png", 146, 0, 60 , 56))
#Init Crayon3D
self.wmHandler = WiimoteHandler()
if(not self.wmHandler.start([WIIMOTE_TRACKER, WIIMOTE_BUTTON])):
self.wmHandler = None
self.cursor = Cursor(['tex/alpha_cursor.png'], self.wmHandler, 0)
#Cursor init
self.pointer = Pointer()
#Events declaration
self.accept("WM_BUTTON_RELEASED", self.handleBtnRelease)
#Tasks
taskMgr.add(self.taskCursor, 'taskCursor')
self.menu = Menu(self.cursor)
#end __init__
#-----------------------------------------------------------------------------------------------------------------------------------------------
#----------------------------------------------------------------FUNCTIONS----------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------------------------------------------
# WiiMote button released handler
def handleBtnRelease(self, btn, dev, index):
if(index == 1):
if(btn == wiiuse.BUTTON_A):
self.selection()
#end handleBtnRelease
# It manages the selection on the menu
def selection(self):
if( self.menu.selected == "CREDITS" ):
# Credits
if( self.creditsActivated == False ):
self.menu.hide()
self.creditsImage = OnscreenImage(image="./tex/credits.png", pos = (0, 0, 0),hpr=None, scale = (1.33,1.0,1.0), color=None, parent=None, sort=3)
self.creditsImage.setTransparency(TransparencyAttrib.MAlpha)
self.creditsActivated = True
else:
self.creditsImage.hide()
self.menu.show()
self.creditsActivated = False
if( self.menu.selected == "PLAY" ):
# Game
self.menu.hide()
self.game = Game(self.back, self.cursor, self.pointer)
self.menu.selected = "HIDE"
if( self.menu.selected == "INS" ):
# Tutorial
self.ins = Tutorial(self.back, self.cursor, self.pointer)
self.menu.hide()
self.menu.selected = "HIDE"
#end selection
# It prepares the application to be closed and quit the game
def quit(self):
# Stop the wiimote handler
if(self.wmHandler):
self.wmHandler.stop()
print "Bye-bye!"
sys.exit()
#end quit
#-----------------------------------------------------------------------------------------------------------------------------------------------
#----------------------------------------------------------------TASKS,THREADS------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------------------------------------------
# It moves the sun pointer according to the mouse or glove.
def taskCursor(self, task):
#.........这里部分代码省略.........