本文整理汇总了Python中clientmenu.Menu.title方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.title方法的具体用法?Python Menu.title怎么用?Python Menu.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clientmenu.Menu
的用法示例。
在下文中一共展示了Menu.title方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: choose_server_ip_in_a_list
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import title [as 别名]
def choose_server_ip_in_a_list(self):
servers_list = None
try:
f = urllib.urlopen(SERVERS_LIST_URL)
if f.read(len(SERVERS_LIST_HEADER)) == SERVERS_LIST_HEADER:
servers_list = f.readlines()
except:
pass
if servers_list is None:
voice.alert([1029]) # hostile sound
warning("couldn't get the servers list from the metaserver"
" => using the default servers list")
servers_list = DEFAULT_SERVERS
nb = 0
menu = Menu()
for s in servers_list:
try:
ip, version, login, port = s.split()[1:]
# ignore the first parameter (time)
except:
warning("line not recognized from the metaserver: %s", s)
continue
nb += 1
if version == VERSION:
menu.append([login, 4073, login], (connect_and_play, ip, port))
menu.title = nb2msg(len(menu.choices)) + [4078] + nb2msg(nb) + [4079]
menu.append([4075, 4076], None)
menu.run()
示例2: choose_server_ip_in_a_list
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import title [as 别名]
def choose_server_ip_in_a_list():
servers = servers_list(voice)
total = 0
compatible = 0
menu = Menu()
for s in servers:
try:
_, ip, version, login, port = s.split()
except ValueError:
warning("line not recognized from the metaserver: %s", s)
else:
total += 1
if version == VERSION:
compatible += 1
menu.append([login], (connect_and_play, ip, port),
mp.SERVER_HOSTED_BY + [login])
menu.title = nb2msg(compatible) + mp.SERVERS_ON + nb2msg(total) + mp.ARE_COMPATIBLE
menu.append(mp.CANCEL2, None, mp.GO_BACK_TO_PREVIOUS_MENU)
menu.run()