当前位置: 首页>>代码示例>>Python>>正文


Python Menu.Menu类代码示例

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


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


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