• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python Menu.Menu类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中Menu.Menu的典型用法代码示例。如果您正苦于以下问题:Python Menu类的具体用法?Python Menu怎么用?Python Menu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Menu类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

	def __init__(self,background):
		"Set up the HighScores menu"
		
		Menu.__init__(self,"MoleFusion HighScore Menu",background)
		
		self.parser = make_parser()
		self.curHandler = Localization()
		self.parser.setContentHandler(self.curHandler)
		self.parser.parse(open("languages/HighScoresMenu_" + Constants.LANGUAGE + ".xml"))
	
		self.title = GW_Label(self.curHandler.getText("title"),(0.5,0.1),(27,22,24))
		
		self.name_column = GW_Label(self.curHandler.getText("name"),(0.25,0.25),(212,224,130))
		self.points_column = GW_Label(self.curHandler.getText("points"),(0.75,0.25),(212,224,130))
		
		self.returnMain = GW_Button(self.curHandler.getText("returnMain"),(0.5,0.9),(255,255,255))
		self.returnMain.add_eventhandler("onmouseclick",self.returnMain_onmouseclick)
		
		h = HighScores()
		highscorelist = h.get_HighScores()

		self.widgetlist = [self.title,self.name_column,self.points_column,self.returnMain]
		
		for val,i in enumerate(highscorelist[0:5]):
			self.widgetlist.append(GW_Label(i.get_name(),(0.25,0.35+val/10.0),(250,254,210)))
			self.widgetlist.append(GW_Label(str(i.get_points()),(0.75,0.35+val/10.0),(250,254,210)))
				
		self.widget_man = GuiWidgetManager(self.widgetlist)
		
		self.time_speed=pygame.time.Clock()
		self.exit=False
		self.on_enter()
开发者ID:reality3d,项目名称:molefusion,代码行数:32,代码来源:HighScoresMenu.py


示例2: __init__

    def __init__(self):
        "Sets up the options menu"

        Menu.__init__(self, "MoleFusion Options Menu", "sprites/back1.jpg")

        self.parser = make_parser()
        self.curHandler = Localization()
        self.parser.setContentHandler(self.curHandler)
        self.parser.parse(open("languages/OptionsMenu_" + Constants.LANGUAGE + ".xml"))

        self.title = GW_Label(self.curHandler.getText("title"), (0.5, 0.1), (27, 22, 24))

        self.name = GW_Label(self.curHandler.getText("name"), (0.5, 0.2), (255, 255, 255))
        self.inputname = GW_TextInput((0.5, 0.3), 24, 0.4, Constants.PLAYERNAME)

        self.language = GW_Button(self.curHandler.getText("language"), (0.5, 0.5), (255, 255, 255))
        self.language.add_eventhandler("onmouseclick", self.language_onmouseclick)

        self.returnMain = GW_Button(self.curHandler.getText("returnMain"), (0.5, 0.8), (255, 255, 255))
        self.returnMain.add_eventhandler("onmouseclick", self.returnMain_onmouseclick)

        self.widget_man = GuiWidgetManager([self.title, self.name, self.inputname, self.language, self.returnMain])

        self.time_speed = pygame.time.Clock()
        self.exit = False
        self.on_enter()
开发者ID:reality3d,项目名称:molefusion,代码行数:26,代码来源:OptionsMenu.py


示例3: __init__

	def __init__(self, player):
		Menu.__init__(self, player)
		
		room		= Engine.RoomEngine.getRoom(player.attributes['roomID'])
		inventory	= room.attributes['inventory']
		
		self.attributes['options'] = {
			'1' : ('. Players', lambda : self.pushMenu(IteratorMenu(player, 
																	lambda p : room.attributes['players'],
																	'name',
																	'look',
																	False))),
																	
			'2' : ('. NPCs', lambda : self.pushMenu(IteratorMenu(player,
																lambda p : room.attributes['npcs'],
																'name',
																'look',
																False))),
																
			'3' : ('. Items', lambda : self.pushMenu(IteratorMenu(player,
																lambda p : inventory.attributes['items'] + inventory.attributes['permanent_items'],
																'name',
																'look',
																False))),
			'4' : ('. Cancel', lambda : self.cancelMenu())
		}
开发者ID:longstl,项目名称:python_mud,代码行数:26,代码来源:ExamineEnvironmentMenu.py


示例4: __init__

    def __init__(self):
        "Sets up the menu"

        Menu.__init__(self, "MoleFusion Main Menu", "sprites/back1.jpg")

        self.parser = make_parser()
        self.curHandler = Localization()
        self.parser.setContentHandler(self.curHandler)
        self.parser.parse(open("languages/MainMenu_" + Constants.LANGUAGE + ".xml"))

        self.title = GW_Label(self.curHandler.getText("title"), (0.5, 0.1), (27, 22, 24))

        self.start = GW_Button(self.curHandler.getText("start"), (0.5, 0.3), (255, 255, 255))
        self.start.add_eventhandler("onmouseclick", self.start_onmouseclick)

        self.options = GW_Button(self.curHandler.getText("options"), (0.5, 0.45), (255, 255, 255))
        self.options.add_eventhandler("onmouseclick", self.options_onmouseclick)

        self.highscores = GW_Button(self.curHandler.getText("highscores"), (0.5, 0.6), (255, 255, 255))
        self.highscores.add_eventhandler("onmouseclick", self.highscores_onmouseclick)

        self.help = GW_Button(self.curHandler.getText("help"), (0.5, 0.75), (255, 255, 255))
        self.help.add_eventhandler("onmouseclick", self.help_onmouseclick)

        self.quit = GW_Button(self.curHandler.getText("quit"), (0.5, 0.9), (255, 255, 255))
        self.quit.add_eventhandler("onmouseclick", self.quit_onmouseclick)

        self.widget_man = GuiWidgetManager(
            [self.title, self.start, self.options, self.highscores, self.help, self.quit]
        )

        self.time_speed = pygame.time.Clock()

        self.on_enter()
开发者ID:reality3d,项目名称:molefusion,代码行数:34,代码来源:MainMenu.py


示例5: __init__

	def __init__(self, player):
		Menu.__init__(self, player)
		
		self.attributes['options'] = {
			'1' : ('. Equipment and Description', lambda : self.executeCommand('look', [player], False)),
			'2' : ('. Inventory', lambda : self.pushMenu(ExamineInventoryMenu(player))),
			'3' : ('. Cancel', lambda : self.cancelMenu())
		}
开发者ID:longstl,项目名称:python_mud,代码行数:8,代码来源:ExamineSelfMenu.py


示例6: __init__

	def __init__(self, player):
		Menu.__init__(self, player)
		
		self.attributes['options'] = {
			'1' : ('. All items', lambda : self.executeCommand('inventory', None, False)),
			'2' : ('. Specific item', lambda : self.pushMenu(ExamineInventoryItemMenu(player))),
			'3' : ('. Cancel', lambda : self.cancelMenu())
		}
开发者ID:longstl,项目名称:python_mud,代码行数:8,代码来源:ExamineInventoryMenu.py


示例7: __init__

	def __init__(self, player):
		Menu.__init__(self, player)
		
		self.attributes['options'] = {
			'1' : ('. Youself', lambda : self.pushMenu(ExamineSelfMenu(player))),
			'2' : ('. Environment', lambda : self.pushMenu(ExamineEnvironmentMenu(player))),
			'3' : ('. Cancel', lambda : self.cancelMenu())
		}
开发者ID:longstl,项目名称:python_mud,代码行数:8,代码来源:ExamineMenu.py


示例8: TestMenu

class TestMenu(unittest.TestCase):


    def setUp(self):
        self.m = Menu()


    def testCheckSystemEnvironment(self):
        self.m.checkWindowsVersion = lambda: "3.1"
        self.assertEquals(self.m.checkSystemEnvironment(), False)

        self.m.checkWindowsVersion = lambda: "6.1"
        self.m.checkFilePath = lambda x: None
        self.assertEquals(self.m.checkSystemEnvironment(), False)

        self.m.checkWindowsVersion = lambda: "6.1"
        self.m.checkFilePath = lambda x: "taskkill.exe"
        self.assertEquals(self.m.checkSystemEnvironment(), True)


    def testWriteInfoLine(self):
        self.assertRaises(ValueError, self.m.writeInfoLine, "ok2", "")
        self.assertEquals(self.m.writeInfoLine("ok", "ok`y info."), None)
        self.assertEquals(self.m.writeInfoLine("warning", "warning info."), None)
        self.assertEquals(self.m.writeInfoLine("error", "error info."), None)
        self.assertEquals(self.m.writeInfoLine("fatal", "fatal error info."), None)
        self.assertEquals(self.m.writeInfoLine("info", "only info."), None)
        self.assertEquals(self.m.writeInfoLine("warning", "custom info.", u"ОПИСАНИЕ"), None)
开发者ID:kirsrus,项目名称:ItvIntellectReglament,代码行数:28,代码来源:TestMenu.py


示例9: main

def main():
    pygame.init()
    
    #Creamos la ventana

    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_caption("VichoPLS")

    #El reloj
    clock = pygame.time.Clock()

    #Ejecutamos el Menu
    continuar = True
    

    miMenu = Menu(load_image,clock,screen)
    miMenu.ejecutarMenu()
    jefecitos = dict()
    jefecitos["Raul"] = Montes
    jefecitos["Luis"] = Dissett
    var=True
    enemigos = [4,8]
    bosses = ["Raul","Luis"]
    count = 0
    x=100
    y=240
    etapa = 1
    while continuar:

        #Ejecutamos la Etapa
        while var and count < len(enemigos):
            miEtapa = Etapa(load_image,clock,screen,4,3000,0.6,enemigos[count],jefecitos[bosses[count]](load_image),bosses[count],x,y,etapa)
            var = miEtapa.ejecutarEtapa("leJuego")
            x = miEtapa.cx
            y = miEtapa.cy
            count += 1
            etapa+=1
        

        if var:
            miVic = Victory(load_image,clock,screen)
            var = miVic.ejecutarMenu()
            if not(var):
                break
            count = 0
        else:
            miGO = GameOver(load_image,clock,screen)
            var = miGO.ejecutarMenu()
            if not(var):
                break
            count = 0

    pygame.mixer.quit()
    pygame.display.quit()
    print "GG"
开发者ID:IWBTE,项目名称:LeJuego,代码行数:55,代码来源:Main.py


示例10: __init__

	def __init__(self, player):
		Menu.__init__(self, player)
		
		self.attributes['options'] = {
			'1'	: ('. Move', lambda : self.pushMenu(IteratorMenu(player,
																lambda p : Engine.RoomEngine.getRoom(p.attributes['roomID']).attributes['exits'],
																'name',
																'go',
																True))),
			'2' : ('. Examine', lambda : self.pushMenu(ExamineMenu(player)))
		}
开发者ID:longstl,项目名称:python_mud,代码行数:11,代码来源:RootMenu.py


示例11: __init__

    def __init__(self, stdscreen):
        self.screen = stdscreen
        curses.curs_set(0)

        title = "Network Monitor - Dion Bosschieter, Timo Dekker - Version: 0.1"

        debug_console = DebugConsole(self.screen, "Debugging information")
        main_window = Window(title, self.screen)
        info_container = InfoContainer(self.screen, "Netwerk info", debug_console)
        gather_information = GatherInformation(info_container, debug_console, "10.3.37.50")

        main_menu_items = [
                ('Connect/Disconnect', gather_information.toggleconnect),
                ('Gather packets', gather_information.getPackets),
                ('Exit', exit)
                ]
        main_menu = Menu(main_menu_items, self.screen, "Main menu", debug_console, info_container)
        
        main_window.display()
        info_container.display()
        debug_console.display()
        debug_console.log("Logging initialized")
        debug_console.log("Network Monitor has started")
        debug_console.log("")
        debug_console.log("Usage:")
        debug_console.log("Press 'q' to quit, 'h' for the menu, 'p' to import newest packets, 'c' to connect and 'd' to disconnect")
        
        
        self.threadstop = 0

        #create refresh deamon
        update_screens = Thread(target=self.updateScreens, args=(debug_console,info_container, main_menu))
        update_screens.daemon = True
        update_screens.start()

        #listen for keypressess
        while(True):
            c = terminal.getch()
            if c == 'q': break
            elif c == 'h':
                self.threadstop = 1
                main_menu.display()
                self.threadstop = 0
                update_screens = Thread(target=self.updateScreens, args=(debug_console,info_container, main_menu))
                update_screens.daemon = True
                update_screens.start()

            elif c == 'p': gather_information.getPackets()
            elif c == 'c': gather_information.connect()
            elif c == 'd': gather_information.disconnect()
开发者ID:dionbosschieter,项目名称:NetworkMonitor,代码行数:50,代码来源:NetworkMonitor.py


示例12: __init__

	def __init__(self):
		self.front = 0
		self.back = 1
		self.left = 2
		self.right = 3
		self.oldLeft = 0
		self.oldTop = 0         
		self.strips = []
		self.starting_pos = True
		self.rect = pygame.Rect(0,0,0,0)
		self.list = []
		self.graphicChoice = 0
		self.itemList = []
		self.choice = self.front
		self.dictLookUp = {}
		self.count = 0
		self.cho = 0
		self.clicked = False
		self.clickedSpot = (0,0)
		self.rightButton = False
		self.menu = Menu()
		self.walking = WalkingGUI()
		self.menu.addChoice("walking")
		self.menu.addChoice("back_pack")
		self.menu.addChoice("testing")
		self.menu.makeBasicMenu()
		#self.LTSelectedString = "nothing" 
		self.which = "nothing"
开发者ID:MichaelHaendler,项目名称:python_video_game1,代码行数:28,代码来源:Person.py


示例13: __init__

    def __init__(self, parent_window, path):

        Gtk.Window.__init__(self)

        self.proyecto_path = path
        self.parent_window = parent_window

        self.set_title("Constructor de Instaladores de Proyecto")
        self.set_icon_from_file(
            os.path.join(BASEPATH, "Iconos", "gandalftux.png"))
        self.set_transient_for(self.parent_window)
        self.set_border_width(15)

        self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.menu = Menu()

        self.vbox.pack_start(self.menu, False, False, 0)
        self.vbox.pack_start(Gtk.Label("Constructor de Instaladores"),
            False, False, 0)

        self.resize(w / 2, h - 40)
        self.move(w - w / 2, 40)

        self.add(self.vbox)
        self.show_all()

        self.menu.connect("accion-menu", self.__accion_menu)
        self.menu.connect("help", self.__emit_help)
开发者ID:fdanesse,项目名称:JAMediaSuite,代码行数:28,代码来源:Instalador.py


示例14: __init__

    def __init__(self, archivos=[]):

        Gtk.Window.__init__(self)

        self.set_title("JAMediaEditor")
        self.set_icon_from_file(os.path.join(BASE_PATH, "Iconos", "JAMediaEditor.svg"))
        self.set_resizable(True)
        self.set_size_request(640, 480)
        self.set_border_width(5)
        self.set_position(Gtk.WindowPosition.CENTER)

        self._help = False

        accel_group = Gtk.AccelGroup()
        self.add_accel_group(accel_group)

        base_widget = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        self.menu = Menu(accel_group)
        self.base_panel = BasePanel()
        self.toolbar_estado = ToolbarEstado()
        self.jamediapygihack = JAMediaPyGiHack()

        base_widget.pack_start(self.menu, False, False, 0)
        base_widget.pack_start(self.base_panel, True, True, 0)
        base_widget.pack_start(self.jamediapygihack, True, True, 0)
        base_widget.pack_start(self.toolbar_estado, False, False, 0)

        self.add(base_widget)
        self.show_all()
        self.maximize()

        self.jamediapygihack.hide()

        self.menu.connect("accion_ver", self.__ejecutar_accion_ver)
        self.menu.connect("accion_codigo", self.__ejecutar_accion_codigo)
        self.menu.connect("accion_proyecto", self.__ejecutar_accion_proyecto)
        self.menu.connect("accion_archivo", self.__ejecutar_accion_archivo)
        self.menu.connect("run_jamediapygihack", self.__run_jamediapygihack)
        self.menu.connect("help", self.__run_help)
        self.jamediapygihack.connect("salir", self.__run_editor)
        self.jamediapygihack.connect("abrir", self.__open_modulo)
        self.base_panel.connect("update", self.__set_toolbar_archivo_and_menu)
        self.base_panel.connect("proyecto_abierto", self.__set_toolbar_proyecto_and_menu)
        self.base_panel.connect("ejecucion", self.__set_toolbars_ejecucion)
        self.base_panel.connect("help", self.__run_help)
        self.connect("delete-event", self.__exit)

        # Cuando se abre el editor con archivo como parámetro.
        for archivo in archivos:
            archivo = os.path.realpath(archivo)
            if os.path.exists(archivo):
                if os.path.isfile(archivo):
                    extension = os.path.splitext(os.path.split(archivo)[1])[1]
                    if extension == ".ide":
                        GLib.idle_add(self.base_panel.external_open_proyect, archivo)
                    else:
                        GLib.idle_add(self.base_panel.external_open_file, archivo)
        # FIXME: Agregar informe de utilizacion de recursos
        print "JAMediaEditor:", os.getpid()
开发者ID:fdanesse,项目名称:JAMediaSuite,代码行数:60,代码来源:JAMediaEditor.py


示例15: __init__

	def __init__(self, player, listGetter, attributeName, command, popMenu):
		Menu.__init__(self, player)
		
		options	= {}
		count	= 1
		
		for element in listGetter(player):
			key				= '{}'.format(count)
			option			= '. {}'.format(element.attributes[attributeName])
			function		= self.createLambda(element, command, popMenu)
			options[key]	= (option, function)
			
			count = count + 1
		
		options['{}'.format(count)] = ('. Cancel', self.cancelMenu)
		
		self.attributes['options'] = options
开发者ID:longstl,项目名称:python_mud,代码行数:17,代码来源:IteratorMenu.py


示例16: TddMenu

class  TddMenu(unittest.TestCase):

	def setUp(self):
		self.menu = Menu()

	def test_menu_empty(self):
		menu = Menu()
		self.assertTrue(len(menu.getOpciones()) == 1)

	def test_menu_invalida(self):
		self.menu.ejecutar('opcionInvalida')
		self.failUnlessEqual(self.menu.mensaje.pop(), 'Opcion Invalida')


	def test_menu_quit(self):
		self.menu.ejecutar('q')
		self.assertTrue(not self.menu.debeCorrer)
开发者ID:jairoDO,项目名称:utilSymfony2,代码行数:17,代码来源:testInterfaz.py


示例17: load

def load():
    m = Menu()
    save0path = variables.savepath
    if (os.path.isfile(save0path)):
        if os.path.getsize(save0path) > 0:
            with open(save0path, "rb") as f:
                loadedlist = pickle.load(f)
                tempplayer = None
                mapsdict, tempcname, tempplayer, classvar.battle, maps.current_map_name, floatingtemp = loadedlist
                if not variables.dontloadplayer:
                    classvar.player = tempplayer
                else:
                    classvar.player.xpos = tempplayer.xpos
                    classvar.player.ypos = tempplayer.ypos
                    for x in range(50):
                        classvar.player.addstoryevent("bed")
             
                if variables.lvcheat != 0:
                    classvar.player.exp = lvexp(explv(classvar.player.exp)+variables.lvcheat)
                if variables.addallrewards:
                    for k in soundpackkeys:
                        classvar.player.addreward(k)
                    for k in scales.keys():
                        classvar.player.addreward(k)
                    
                if not variables.dontloadmapsdict:
                    conversations.floatingconversations = floatingtemp
                    loadmaps(mapsdict)
                    if tempcname in conversations.floatingconversations.keys():
                        conversations.currentconversation = conversations.floatingconversations[tempckey]
                    else:
                        if tempcname != None:
                            conversations.currentconversation = maps.map_dict[maps.current_map_name].getconversation(tempcname)

                maps.change_map_nonteleporting(maps.current_map_name)
                # don't start at beginning
                m.firstbootup = False
                
    if (not isinstance(classvar.battle, str)):
        classvar.battle.reset_enemy()

    if variables.settings.state == "game":
        initiategame(variables.settings.currentgame)
    
    return m
开发者ID:oflatt,项目名称:pythonRpgProject,代码行数:45,代码来源:saveandload.py


示例18: __init__

 def __init__(self):
     pygame.init()
     self.font = pygame.font.SysFont('sans-serif', 18, True)
     self.surface = pygame.display.set_mode(self.SCREEN_SIZE, 0, 32)
     self.state = 'intro'
     self.hiscores = Score.read_high_score()
     self.menu = Menu(("Start game", "Quit"))
     pygame.mixer.music.load(self.MUSIC_FILE)
     pygame.mixer.music.play(-1)
开发者ID:span,项目名称:taxrunner,代码行数:9,代码来源:Game.py


示例19: Connexion

class Connexion(QMainWindow, Ui_MainWindow):
    """
    Class documentation goes here.
    """
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget (QWidget)
        """
        super().__init__(parent)
        self.setupUi(self)
    
    @pyqtSlot()
    def on_buttonBox_2_accepted(self):
        """
        Slot documentation goes here.
        """
        # TODO: not implemented yet
        # acces à la BDD
        db = GestionBdd('db')
        login = self.login.text()
        password = self.password.text()
        connexion = db.premiere_connexion(login, password)
        
        if connexion == True:            
            self.close()
            self.menu = Menu()
            self.menu.show()
        else:
#            self.emit(SIGNAL("Fermeture(PyQT_PyObject)"), connexion)
            QMessageBox.information(self, 
                    self.trUtf8("Erreur connexion "), 
                    self.trUtf8("Erreur sur le login et/ou mot de passe")) 

    
    @pyqtSlot()
    def on_buttonBox_2_rejected(self):
        """
        Slot documentation goes here.
        """
        # TODO: not implemented yet
        self.close()
开发者ID:Pepou,项目名称:Labotemp-v1.2,代码行数:43,代码来源:connexion2.py


示例20: __init__

 def __init__(self, engine, items, selected = None, prompt = ""):
   self.prompt         = prompt
   self.engine         = engine
   self.accepted       = False
   self.selectedItem   = None
   self.time           = 0.0
   self.menu = Menu(self.engine, choices = [(c, self._callbackForItem(c)) for c in items], onClose = self.close, onCancel = self.cancel)
   if selected and selected in items:
     self.menu.selectItem(items.index(selected))
   self.engine.loadSvgDrawing(self, "background", "editor.svg")
开发者ID:miracle2k,项目名称:fretsonfire,代码行数:10,代码来源:Dialogs.py



注:本文中的Menu.Menu类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python MenuList.MenuList类代码示例发布时间:2022-05-24
下一篇:
Python Matrix.Matrix类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap