本文整理汇总了Python中menu.menu函数的典型用法代码示例。如果您正苦于以下问题:Python menu函数的具体用法?Python menu怎么用?Python menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了menu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ysha512
def ysha512():
print ("\n\t [>] 1: ASCII -> sha512")
# print('\t [>] 2: sha512 -> ASCII')
print ("\t [>] m: Menu principal")
print ("\t [>] q: Quitter\n")
choice_var = raw_input(" [>] Que souhaitez vous faire? (1/2/m/q): ")
if choice_var == "1":
__hashsha512__()
# if(choice_var=='2'):
# __cracksha512__()
if choice_var == "m":
menu.menu()
if choice_var == "q":
print ("\nMerci d'avoir utilise cet utilitaire.")
quit()
else:
print "Votre souhait est invalide. \n"
ysha512()
示例2: mainmenu
def mainmenu(icon,level,path,isQuit):
SCREEN.fill(BGCOLOR)
drawGrid()
pygame.display.update()
pygame.display.set_caption('Menu')
font = pygame.font.Font(None,80)
text = font.render("Guitar Game", 20,(WHITE))
SCREEN.blit(text,(10,10))
SCREEN.blit(icon, (350,150))
if level[0]!=None and path[0]!=None:
option = menu.menu(SCREEN,
['Start','Level: %d' % level[0],'Load: %s' % path[0].split("/")[-1] ,'Exit'],
128,128,None,64,1.2,WHITE,RED)
elif level[0]!=None:
option = menu.menu(SCREEN,
['Start','Level: %d' % level[0],'Load','Exit'],
128,128,None,64,1.2,WHITE,RED)
elif path[0]!=None:
option = menu.menu(SCREEN,
['Start','Level: %d','Load: %s' % path[0].split("/")[-1],'Exit'],
128,128,None,64,1.2,WHITE,RED)
else:
option = menu.menu(SCREEN,
['Start','Level','Load' ,'Exit'],
128,128,None,64,1.2,WHITE,RED)
if option == -1:
terminate(isQuit)
if option == 0:
if path[0]!=None and level[0]!=None:
pygame.mixer.music.stop()
option = 0
print level[0]
#################### startGame ####################
main2(path[0],level[0],path[0].split("/")[-1])
level[0]=None
path[0]=None
isQuit[0]=0
#terminate(isQuit)
else:
print "Please choose level and load a music first"
elif option == 1:
levelload(level)
option = 0
elif option == 2:
if level[0]!= None:
load(path,level[0])
else:
level[0]=2
load(path,level[0])
option = 0
elif option == 3:
terminate(isQuit)
示例3: create_new_user
def create_new_user(self,address,password,root):
import menu as menu
check=0
match = re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', address)
if match == None:
print("It's not an E-Mail address")
elif password=="":
print("Please Enter a valid password")
else:
connection = sqlite3.connect('listplayer.db')
connection.execute("""CREATE TABLE IF NOT EXISTS players (Email TEXT,Password TEXT,Score INTEGER)""")
cursor = connection.execute("SELECT Email, Password FROM players")
for i in cursor:
if i[0]==address:
print("This Email is already registered")
check=1
if check==0:
connection.execute('''INSERT INTO players (Email, Password, Score) VALUES ("'''+address+'''","'''+password+'''",'''+str(0)+''')''')
connection.commit()
connection.close()
print("Account created")
root.destroy()
menu.menu(address)
示例4: ybase2
def ybase2():
print ("\n\t [>] 1: ASCII -> Base2")
print ("\t [>] 2: Base2 -> ASCII")
print ("\t [>] m: Menu principal")
print ("\t [>] q: Quitter\n")
choice_var = raw_input(" [>] Que souhaitez vous faire? (1/2/m/q): ")
if choice_var == "1":
__encodezb2__()
if choice_var == "2":
__decodezb2__()
if choice_var == "m":
menu.menu()
if choice_var == "q":
print ("\nMerci d'avoir utilise cet utilitaire.")
quit()
else:
print "Votre souhait est invalide. \n"
ybase2()
示例5: ycrc32
def ycrc32():
print('\n\t [>] 1: ASCII -> crc32')
# print('\t [>] 2: crc32 -> ASCII')
print('\t [>] m: Menu principal')
print('\t [>] q: Quitter\n')
choice_var=raw_input(' [>] Que souhaitez vous faire? (1/2/m/q): ')
if(choice_var=='1'):
__hashcrc32__()
# if(choice_var=='2'):
# __crackcrc32__()
if(choice_var=='m'):
menu.menu()
if(choice_var=='q'):
print('\nMerci d\'avoir utilise cet utilitaire.')
quit()
else:
print "Votre souhait est invalide. \n"
ycrc32()
示例6: ybase32
def ybase32():
print('\n\t [>] 1: ASCII -> Base32')
print('\t [>] 2: Base32 -> ASCII')
print('\t [>] m: Menu principal')
print('\t [>] q: Quitter\n')
choice_var=raw_input(' [>] Que souhaitez vous faire? (1/2/m/q): ')
if(choice_var=='1'):
__encodezb32__()
if(choice_var=='2'):
__decodezb32__()
if(choice_var=='m'):
menu.menu()
if(choice_var=='q'):
print('\nMerci d\'avoir utilise cet utilitaire.')
quit()
else:
print "Votre souhait est invalide. \n"
ybase32()
示例7: main
def main():
pygame.init()
if pygame.mixer and not pygame.mixer.get_init():
print ('Warning, no sound')
pygame.mixer = None
pygame.mixer.music.load('data/tchtada.ogg')
pygame.mixer.music.play(-1)
joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())]
if joysticks:
joystick=joysticks[0]
joystick.init()
const.font_init()
# Set the display mode
winstyle = 0 # |FULLSCREEN
bestdepth = pygame.display.mode_ok(SCREENRECT.size, winstyle, 32)
screen = pygame.display.set_mode(SCREENRECT.size, winstyle, bestdepth)
todo = menu.menu(screen)
while todo != 'quit':
if todo == 'play':
score = game(screen)
highscore.call(screen,score)
elif todo == 'score':
highscore.call(screen,None)
todo = menu.menu(screen)
if pygame.mixer:
pygame.mixer.music.fadeout(1000)
pygame.quit()
示例8: username1
def username1(client) :
temporary = getstatusoutput("dir /home/")
names = temporary[1]
temp = send_recv("dialog --inputbox \" Enter User Name : \" 10 30")
if names.rfind(temp) == -1 :
send("recieve only")
send("dialog --infobox \" No such Directory Exists...\n Sending to Main Menu...\" 7 35")
sleep(2.5)
import menu
menu.menu(client)
return temp
示例9: main
def main():
environ["SDL_VIDEO_CENTERED"] = "1"
pygame.init()
if not pygame.font:
print "Warning, fonts disabled, game not playable"
pygame.time.delay(1500)
sysexit()
if not pygame.mixer:
print "Warning, sound disabled"
screen = pygame.display.set_mode((800, 800))
pygame.display.set_caption("Hanjie")
pygame.display.update()
menu.menu(screen)
示例10: launch
def launch():
pygame.init()
clock = pygame.time.Clock()
if conf.fullscreen:
window = pygame.display.set_mode((800, 600), FULLSCREEN)
else:
window = pygame.display.set_mode((800, 600))
# hide cursor
pygame.mouse.set_visible(False)
menu(window, clock)
示例11: main
def main(): #主函数
a=0#锁定判断标志位
while True:
if a == 3:#用户输入超过3次执行lock函数并退出循环
lock_user(u_name)
print("尝试3次登录失败,用户%s 锁定 程序退出"%(u_name))
break
else:
u_name = input("Enter your username:")
u_passwd = input("Enter you password:")
if login(u_name,u_passwd) == False:#如果login函数返回的结果为False则让a自加1
a+=1
continue
else:
menu.menu()
示例12: main
def main():
Liste = {}
Liste['1'] = 'Text -> Morse'
Liste['2'] = 'Morse -> Text'
Liste['3'] = 'Beenden'
setup()
try:
while 1:
os.system("clear")
off(green)
off(red)
off(yellow)
choice = menu(Liste, "Modus Wählen")
if choice == 1:
message = input('Text: ').lower()
toMorse(message)
elif choice == 2:
print('Nicht Implementiert')
input('Press OK')
elif choice == 3:
off(green)
off(red)
off(yellow)
break
print("fertig")
G.cleanup()
except (KeyboardInterrupt, SystemExit):
print("/n abgebrochen/n")
G.cleanup()
示例13: yhelp
def yhelp():
print("\
\tAIDE:\n\n\
Dans le menu principal ci-contre, vous pouvez avoir acces a différentes\n\
options en fonctions de ce que vous cherchez a faire. Apres avoir entré\n\
le numero de l'option souhaitez vous aurez accès a différentes propositions\n\
vous permettant de convertir votre \"String\" en ASCII.\n\n\
\tINFO SUR LE PROGRAMME:\n\n\
Cette utilitaire a été réalisé par Maxime Berthault (Maxou56800) sous license\n\
GPL (GENERAL PUBLIC LICENCE) afin de permettre à d'autres personnes de le \n\
modifier et l'amélioré a sa façon. Ce programme a pour but d'entreiner les \n\
débutants à s'intéresser à toute la partie algorithmes de chiffrements en \n\
informatique.")
menu.menu()
#############################
示例14: check_level_up
def check_level_up():
level_up_xp = settings.LEVEL_UP_BASE + settings.player.level * \
settings.LEVEL_UP_FACTOR
if settings.player.fighter.xp >= level_up_xp:
settings.player.level += 1
settings.player.fighter.xp -= level_up_xp
message('Your battle skills grow stronger. You reached level ' +
str(settings.player.level) + '.', color.yellow)
choice = None
while choice is None:
choice = menu('Level up! Choose a stat to raise:\n',
['Constitution (+20 HP, from ' +
str(settings.player.fighter.max_hp) + ')',
'Strength (+1 attack, from ' +
str(settings.player.fighter.power) + ')',
'Agility (+1 defense, from ' +
str(settings.player.fighter.defense) + ')'],
settings.LEVEL_SCREEN_WIDTH)
if choice == 0:
settings.player.fighter.max_hp += 20
settings.player.fighter.hp += 20
elif choice == 1:
settings.player.fighter.power += 1
elif choice == 2:
settings.player.fighter.defense += 1
示例15: main
def main(client) :
temporary = getstatusoutput("dir /home/")
names = temporary[1]
names = names + "root"
client.send("dialog --inputbox \" User Name : \" 9 30")
user = client.recv(2048)
client.send("dialog --insecure --passwordbox \" Password : \" 9 30")
password = client.recv(2048)
if names.rfind(user) == -1 or password != "redhat" :
client.send("recieve only")
client.send("dialog --infobox \"Incorrect Password or User Name \n Terminating....\" 5 40")
sleep(2)
client.send("false")
else :
client.send("recieve only")
client.send("dialog --infobox \"Authentified User \n Processing...\" 5 25")
sleep(2)
import menu
menu.menu(client)