本文整理汇总了Python中Menu.setFocus方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.setFocus方法的具体用法?Python Menu.setFocus怎么用?Python Menu.setFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu.setFocus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Menu
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import setFocus [as 别名]
#menu constructors
mainMenu = Menu()
menu2 = Menu()
pauseMenu = Menu()
statsMenu = Menu()
#menu initialization
s = open('Text.py', 'r').read()
tpanel = Panel((400, 720), (0, 0))
tpanel.setOptions([Option((tpanel.getCenter()[0] - 15, 100), "Button 1", button1Click, [mainMenu]),\
Option((tpanel.getCenter()[0] - 15, 200), "Button 2", button2Click, []),\
Option((tpanel.getCenter()[0] - 15, 300), "Button 3", button3Click, [menu2]),\
Option((tpanel.getCenter()[0] - 15, 400), "Exit", button4Click, [])])
mainMenu.addPanel(tpanel)
mainMenu.setFocus(0)
tpanel = Panel((800, 720), (400, 0))
tpanel.setTexts([Text((0, 0), 25, maxwidth = tpanel.getMaxWidth())])
mainMenu.addPanel(tpanel)
mainMenu.addText(s, 1, 0)
panel = Panel((1200, 720), (0, 0))
panel.setTexts([Text((0, panel.getCenter()[1]), 50)])
menu2.addPanel(panel)
menu2.addText("You Pressed button 3!!", 0, 0)
panel = Panel((400, 720), (0,0))
panel2 = Panel((800, 720), (400, 0))
panel.setOptions([Option((panel.getCenter()[0] - 15, 100), "1: Stats", pauseMenuRunStats, [statsMenu])])
pauseMenu.addPanel(panel)
pauseMenu.addPanel(panel2)