本文整理汇总了Python中Menu.create方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.create方法的具体用法?Python Menu.create怎么用?Python Menu.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu.create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import create [as 别名]
def init():
# on initialise la fenetre curses
curses.initscr()
win = curses.newwin(30, 80, 0, 0)
curses.noecho()
curses.curs_set(0)
win.nodelay(1)
logging.basicConfig(filename='snake.log', level=logging.INFO)
# creation du niveau
level = Level.create(1, 'levels.txt')
# creation du snake
snake = Snake.create(35, 15, 1, 2)
# creation du food
food = None
# creation du menu
menu = Menu.create(
'Change name',
'Change difficulty',
'Select level',
'Show HighScores',
'Play',
'Quit game'
)
# definition de l'etat du programme
state = 'menu'
# definition du nom du joueur
name = 'player1'
# definition de la difficulte
difficulty = 2
score = -1
HighScoreTable = HighScores.get()
# creation de la variable de type game
game = Game.create(
menu,
level,
snake,
food,
win,
state,
name,
difficulty,
score,
HighScoreTable
)
return game
示例2: init
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import create [as 别名]
import Player
import Menu
import Settings
import Utils
# Interaction clavier
old_settings = termios.tcgetattr(sys.stdin)
# Donnee du jeu
direction = "None"
dt = 0.02
game = Game.create()
settings = Settings.create()
menu = Menu.create()
refresh = True
def init():
#interaction clavier
tty.setcbreak(sys.stdin.fileno())
#cacher le curseur
os.system('setterm -cursor off')
Menu.setCurrentWindow(menu, "mainMenu")
Menu.show(menu)
def run():
n = 0
gameState = "run"