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


Python Menu.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
    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,代码行数:28,代码来源:OptionsMenu.py

示例2: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	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,代码行数:28,代码来源:ExamineEnvironmentMenu.py

示例3: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	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,代码行数:34,代码来源:HighScoresMenu.py

示例4: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
    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,代码行数:36,代码来源:MainMenu.py

示例5: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	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,代码行数:10,代码来源:ExamineMenu.py

示例6: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	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,代码行数:10,代码来源:ExamineSelfMenu.py

示例7: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	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,代码行数:10,代码来源:ExamineInventoryMenu.py

示例8: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	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,代码行数:13,代码来源:RootMenu.py

示例9: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	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,代码行数:19,代码来源:IteratorMenu.py

示例10: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	def __init__(self, player):
		Menu.__init__(self, player)
		
		
		self.attributes['options'] = {
		}
		
		inventory	= player.attributes['inventory']
		options		= {}
		count		= 1
		items		= []
		equipped	= []
		
		for key in inventory.attributes['equipment'].keys():
			equippedItem = inventory.attributes['equipment'][key]
			
			if key == 'Neck' or key == 'Wrist' or key == 'Finger':
				for item in equippedItem:
					if item != None:
						equipped.append(item)
			else:
				if equippedItem != None:
					equipped.append(equippedItem)	
		
		for item in equipped:
			key				= '{}'.format(count)
			itemName		= '. {} (Equipped)'.format(item.attributes['name'])
			function		= self.createViewer(item)
			options[key]	= (itemName, function)
			
			count = count + 1
		
		for item in inventory.attributes['items']:
			key				= '{}'.format(count)
			itemName		= '. {}'.format(item.attributes['name'])
			function		= self.createViewer(item)
			options[key]	= (itemName, function)
			
			count = count + 1
		
		options['{}'.format(count)] = ('. Cancel', self.cancelMenu)
		
		self.attributes['options'] = options
开发者ID:longstl,项目名称:python_mud,代码行数:45,代码来源:ExamineInventoryItemMenu.py

示例11: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	def __init__(self):
		"Set up the Exit menu"
		
		Menu.__init__(self,"MoleFusion Exit Menu","sprites/back1.jpg")
		
		self.parser = make_parser()
		self.curHandler = Localization()
		self.parser.setContentHandler(self.curHandler)
		self.parser.parse(open("languages/ExitMenu_" + Constants.LANGUAGE + ".xml"))
	
		self.title = GW_Label(self.curHandler.getText("title"),(0.5,0.1),(27,22,24))
		
		self.game_by = GW_Label(self.curHandler.getText("game"),(0.5,0.3),(240,255,220))
		self.music_by = GW_Label(self.curHandler.getText("music"),(0.5,0.5),(240,255,220))
		self.web = GW_Label(self.curHandler.getText("web"),(0.5,0.7),(255,255,255))
						
		self.widget_man = GuiWidgetManager([self.title,self.game_by,self.music_by,self.web])
		
		self.time_speed=pygame.time.Clock()
		self.exit=False
		self.on_enter()
开发者ID:reality3d,项目名称:molefusion,代码行数:23,代码来源:ExitMenu.py

示例12: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
    def __init__(self, _engine):
        """
        This function will initialise the main screen of the options
        and prepare the tabs with the various settings
        """
        Menu.__init__(self)

        # Engine
        self.engine = _engine

        self.initGeneralTab()
        self.initControlTab()

        self.currentTab = [0]

        self.tabGroup = [
            DirectRadioButton(
                text = _("General"),
                variable = self.currentTab,
                value = [0],
                scale = 0.05,
                pos = (-0.6, 0, 0.65),
                command = self.showGeneralTab),
            DirectRadioButton(
                text = _("Controls"),
                variable = self.currentTab,
                value = [1],
                scale = 0.05,
                pos = (0.6, 0, 0.65),
                command = self.showControlTab)
            ]

        for tab in self.tabGroup:
            tab.reparentTo(self.frameMain)
            tab.setOthers(self.tabGroup)

        # set the text of all GUI elements
        self.setText()

        self.hideBase()
开发者ID:grimfang,项目名称:rising_reloaded,代码行数:42,代码来源:MenuOptions.py

示例13: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	def __init__(self):
		"Sets up the Language menu"
		
		Menu.__init__(self,"Language Main Menu","sprites/back1.jpg")

		self.title = GW_Label("Choose Language",(0.5,0.15),(27,22,24))
		
		self.english = GW_Image("sprites/language_engl.png",(0.25,0.35))
		self.english.add_eventhandler("onmouseclick",self.english_onmouseclick)

		self.spanish= GW_Image("sprites/language_espn.png",(0.5,0.35))
		self.spanish.add_eventhandler("onmouseclick",self.spanish_onmouseclick)
		
		self.euskera = GW_Image("sprites/language_eusk.png",(0.75,0.35))
		self.euskera.add_eventhandler("onmouseclick",self.euskera_onmouseclick)

		self.widget_man = GuiWidgetManager([self.title,self.english,self.spanish,self.euskera])
		
		self.time_speed=pygame.time.Clock()
		self.exit=False
		
		self.on_enter()
开发者ID:reality3d,项目名称:molefusion,代码行数:24,代码来源:LanguageMenu.py

示例14: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
	def __init__(self):
		"Sets up the Help menu"
		
		Menu.__init__(self,"MoleFusion Help Menu","sprites/back1.jpg")
		
		self.parser = make_parser()
		self.curHandler = Localization()
		self.parser.setContentHandler(self.curHandler)
		self.parser.parse(open("languages/HelpMenu_" + Constants.LANGUAGE + ".xml"))
	
		self.title = GW_Label(self.curHandler.getText("title"),(0.5,0.1),(27,22,24))
		
		self.help = GW_Image(self.curHandler.getText("help"),(0.5,0.3))
						
		self.returnMain = GW_Button(self.curHandler.getText("returnMain"),(0.5,0.5),(255,255,255))
		self.returnMain.add_eventhandler("onmouseclick",self.returnMain_onmouseclick)
		
		self.widget_man = GuiWidgetManager([self.title,self.help,self.returnMain])
		
		self.time_speed=pygame.time.Clock()
		self.exit=False
		self.on_enter()
开发者ID:reality3d,项目名称:molefusion,代码行数:24,代码来源:HelpMenu.py

示例15: __init__

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import __init__ [as 别名]
    def __init__(self):
        Menu.__init__(self)

        screenResMultiplier = 1.33

        self.btnStart = DirectButton(
            # size of the button
            scale = (0.25, 0.25, 0.25),
            # some temp text
            text = "ABC",
            # size of the text
            text_scale = (0.5*screenResMultiplier, 0.5, 0.5),
            # set the alignment to right
            text_align = TextNode.ARight,
            # put the text on the right side of the button
            text_pos = (4.1, -0.15),
            # set the text color to white
            text_fg = (1,1,1,1),
            # set the font of the text
            #text_font = self.defaultFont,
            # set the buttons images
            geom = (self.defaultBtnMaps.find("**/button_ready"),
                    self.defaultBtnMaps.find("**/button_click"),
                    self.defaultBtnMaps.find("**/button_rollover"),
                    self.defaultBtnMaps.find("**/button_disabled")),
            # set no relief
            relief = 1,
            frameColor = (0,0,0,0),
            # No sink in when press
            pressEffect = False,
            # position on the window
            pos = (-1, 0, .55),
            # the event which is thrown on clickSound
            command = self.btnStart_Click,
            # sounds that should be played
            rolloverSound = None,
            clickSound = None)
        self.btnStart.setTransparency(1)

        levellist = []
        initialitem = 0
        for (path, dirs, files) in os.walk("game/assets/levels"):
            for f in files:
                if f.endswith(".egg"):
                    print f.rstrip(".egg")
                    levellist.append(f.rstrip(".egg"))
        self.cmbLanguage = DirectOptionMenu(
            text = "Levels",
            scale = 0.15,
            pos = (base.a2dLeft + 1.5, 0, 0.50),
            items = levellist,
            initialitem = initialitem,
            highlightColor = (0.65,0.65,0.65,1),
            command = self.cmbLevel_SelectionChanged)
        self.selectedLevel = levellist[initialitem]

        self.btnOptions = DirectButton(
            scale = (0.25, 0.25, 0.25),
            # some temp text
            text = "ABC",
            text_scale = (0.45*screenResMultiplier, 0.45, 0.45),
            # set the alignment to right
            text_align = TextNode.ARight,
            # put the text on the right side of the button
            text_pos = (4.1, -0.15),
            # set the text color to white
            text_fg = (1,1,1,1),
            # set the font of the text
            #text_font = self.defaultFont,
            # set the buttons images
            geom = (self.defaultBtnMaps.find("**/button_ready"),
                    self.defaultBtnMaps.find("**/button_click"),
                    self.defaultBtnMaps.find("**/button_rollover"),
                    self.defaultBtnMaps.find("**/button_disabled")),
            relief = 1,
            frameColor = (0,0,0,0),
            pressEffect = False,
            pos = (-1.5, 0, .15),
            command = self.btnOptions_Click,
            rolloverSound = None,
            clickSound = None)
        self.btnOptions.setTransparency(1)

        self.btnQuit = DirectButton(
            scale = (0.25, 0.25, 0.25),
            # some temp text
            text = "ABC",
            text_scale = (0.5*screenResMultiplier, 0.5, 0.5),
            # set the alignment to right
            text_align = TextNode.ARight,
            # put the text on the right side of the button
            text_pos = (4.1, -0.15),
            # set the text color to white
            text_fg = (1,1,1,1),
            # set the font of the text
            #text_font = self.defaultFont,
            # set the buttons images
            geom = (self.defaultBtnMaps.find("**/button_ready"),
                    self.defaultBtnMaps.find("**/button_click"),
                    self.defaultBtnMaps.find("**/button_rollover"),
#.........这里部分代码省略.........
开发者ID:grimfang,项目名称:rising_reloaded,代码行数:103,代码来源:MenuMain.py


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