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


Python Menu.hide方法代码示例

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


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

示例1: show_menu

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import hide [as 别名]
	def show_menu(self, command, options):
		"""Shows the tab-completion menu"""
		menu = Menu(self.win, options )
		option = menu.run()
		menu.hide()
		if option is not None:
			self.set_buffer(command + ' ' + option)
开发者ID:dantheta,项目名称:cursesfrp,代码行数:9,代码来源:input.py

示例2: MACEntry

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import hide [as 别名]

#.........这里部分代码省略.........
            else:
                (mac_segment_width, mac_segment_height) = get_content_size(mac_segment)
                mac_segment_x = mac_segment_distance * mac_segment_index
                mac_segment_offset_x = (mac_segment_distance - mac_segment_width) / 2
                mac_char_width = mac_segment_width / len(mac_segment)

                # Append mac char position.
                for (mac_char_index, mac_char) in enumerate(mac_segment):
                    self.cursor_positions.append(mac_segment_x + mac_segment_offset_x + mac_char_width * mac_char_index)

                # Append the position of last char in mac segment.
                self.cursor_positions.append(mac_segment_x + mac_segment_offset_x + mac_char_width * (mac_char_index + 1))

    def button_press_mac_entry(self, widget, event):
        self.draw_area.grab_focus()

        if event.x <= self.cursor_positions[0]:
            self.set_cursor_index(0)
        elif event.x >= self.cursor_positions[-1]:
            self.set_cursor_index(len(self.mac))
        else:
            ip_segment_distance = self.width / self.segment_number
            segment_index = int(event.x / ip_segment_distance)

            for (cursor_index, cursor_position) in enumerate(self.cursor_positions):
                if len(self.mac.split(self.segment_split_char)[segment_index]) == 0:
                    self.set_cursor_index(segment_index)
                    break
                elif cursor_position < event.x <= self.cursor_positions[cursor_index + 1]:
                    self.set_cursor_index(cursor_index)
                    break

        # Hide right menu immediately.
        self.right_menu.hide()

        if is_double_click(event):
            self.highlight_current_segment()
        elif is_left_button(event):
            self.clear_highlight_segment()
        elif is_right_button(event):
            x, y = self.window.get_root_origin()
            wx, wy = int(event.x), int(event.y)
            (offset_x, offset_y) = widget.translate_coordinates(self, 0, 0)
            (_, px, py, modifier) = widget.get_display().get_pointer()
            self.right_menu.show((px - offset_x, py - wy - offset_y + widget.allocation.height))

        self.queue_draw()

    def select_current_segment(self):
        '''
        Select current mac segment.
        '''
        self.highlight_current_segment()
        self.queue_draw()

    def cut_to_clipboard(self):
        '''
        Cut mac address to clipboard.
        '''
        clipboard = gtk.Clipboard()
        clipboard.set_text(self.get_mac())
        self.set_mac(self.default_address)
        self.move_to_start()

    def copy_to_clipboard(self):
        '''
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:70,代码来源:net.py

示例3: Main

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import hide [as 别名]

#.........这里部分代码省略.........
        base.cTrav = CollisionTraverser("base collision traverser")
        base.pusher = CollisionHandlerPusher()
        self.menu = Menu()
        self.credits = Credits()
        self.charSelection = CharacterSelection()
        self.levelSelection = LevelSelection()
        self.koScreen = KoScreen()
        self.hud = Hud()
        self.menuMusic = loader.loadMusic("assets/audio/menuMusic.ogg")
        self.menuMusic.setLoop(True)
        self.fightMusic = loader.loadMusic("assets/audio/fightMusic.ogg")
        self.fightMusic.setLoop(True)
        base.audio3d = Audio3DManager(base.sfxManagerList[0], camera)

        #
        # Event handling
        #
        self.accept("escape", self.__escape)

        #
        # Start with the menu
        #
        self.request("Menu")

    #
    # FSM PART
    #
    def enterMenu(self):
        show_cursor()
        self.accept("Menu-Start", self.request, ["CharSelection"])
        self.accept("Menu-Credits", self.request, ["Credits"])
        self.accept("Menu-Quit", self.quit)
        self.ignore("KoScreen-Back")
        self.koScreen.hide()
        self.menu.show()
        if self.menuMusic.status() != AudioSound.PLAYING:
            self.menuMusic.play()
        if self.fightMusic.status() == AudioSound.PLAYING:
            self.fightMusic.stop()

    def exitMenu(self):
        self.ignore("Menu-Start")
        self.ignore("Menu-Credits")
        self.ignore("Menu-Quit")
        self.menu.hide()

    def enterCredits(self):
        self.accept("Credits-Back", self.request, ["Menu"])
        self.koScreen.hide()
        self.credits.show()

    def exitCredits(self):
        self.ignore("Credits-Back")
        self.credits.hide()

    def enterCharSelection(self):
        self.accept("CharSelection-Back", self.request, ["Menu"])
        self.accept("CharSelection-Start", self.request, ["LevelSelection"])
        self.charSelection.show()

    def exitCharSelection(self):
        self.ignore("CharSelection-Start")
        self.ignore("CharSelection-Back")
        self.charSelection.hide()
        self.selectedChar1 = self.charSelection.selectedCharacter1
        self.selectedChar2 = self.charSelection.selectedCharacter2
开发者ID:jorjuato,项目名称:panda3d-tutorial,代码行数:70,代码来源:main.py

示例4: Menu

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import hide [as 别名]
	return ch == curses.KEY_MOUSE

# Create main menu
mainMenuNames = [" Connect to Database ", " Help ", " Quit "]
mainMenuY = 2
mainMenu = Menu(mainMenuY, curses.COLS/4, len(mainMenuNames), curses.COLS, mainMenuNames, False, SELECTED_COLOR)

# Create window to use to clear everything but the tab bar area
helpWin = curses.newwin(curses.LINES - mainMenuY + 3, curses.COLS, mainMenuY + 3, 0)

# Create menu for previously connected databases (then hide it)
prevDatabaseNames = getNicknames()
prevDatabasesMaxX = 20
mainMenuY += 4
prevDatabasesMenu = Menu(mainMenuY, 0, curses.LINES - 9, prevDatabasesMaxX, prevDatabaseNames, True, SELECTED_COLOR)
prevDatabasesMenu.hide()

# Create input boxes
inputPrompts = ["\nusername:", "\npassword:", "\n db name:", "\nhostname:", "\nnickname:"]
databaseInputBoxes = []
databaseInputBoxesX = prevDatabasesMaxX + 2
databaseInputBoxesY = []
for i in range(0, 5): 
	databaseInputBoxesY.append(mainMenuY + i*3)
	databaseInputBoxes.append(InputBox(inputPrompts[i], databaseInputBoxesY[i], databaseInputBoxesX, 1))
	databaseInputBoxes[i].hide()

# Three connect buttons and a delete button for the previously save DBs
prevConnect = Menu(curses.LINES - 1, 0, 1, 12, ["connect"])
prevDelete = Menu(curses.LINES - 1, 10, 1, 12, ["delete"])
newsqlConnect = Menu(curses.LINES - 1, databaseInputBoxesX, 1, 16, ["sql connect"]) 
开发者ID:LAnderson8899,项目名称:CS419-Group8,代码行数:33,代码来源:nav.py

示例5: FSMGame

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import hide [as 别名]
class FSMGame(FSM):
    def __init__(self):
        FSM.__init__(self, "FSM-Game")
        self.menu = Menu()
        self.gameResult = Result()
        self.numNPCs = 7

        self.musicMenu = loader.loadMusic("Eraplee Noisewall Orchestra - Bermuda Fire.ogg")
        self.musicMenu.setLoop(True)
        self.musicGame = loader.loadMusic("Echovolt - Nothing to Fear.ogg")
        self.musicGame.setLoop(True)

    def enterMenu(self):
        helper.show_cursor()
        self.menu.show()
        self.musicMenu.play()

    def exitMenu(self):
        self.menu.hide()
        self.musicMenu.stop()

    def enterSingleplayer(self):
        helper.hide_cursor()

        self.musicGame.play()

        self.world = World()

        self.player = Player()
        self.player.setPos(self.world.getStartPos(1))
        self.player.setTeam("Yellow")
        self.player.setColor(LPoint3f(1, 1, 0))

        #self.player.setSpectator(self.world.getSpectatorNode())

        # create non player characters
        self.npcs = []
        for i in range(self.numNPCs):
            self.npcs.append(NPC())
            self.npcs[i].setPos(self.world.getStartPos(i+2))
            self.npcs[i].setBunker(self.world.getBunker())
            if i < self.numNPCs/2:
                self.npcs[i].setTeam("Yellow")
                self.npcs[i].setColor(LPoint3f(1, 1, 0))
            else:
                self.npcs[i].setTeam("Blue")
                self.npcs[i].setColor(LPoint3f(0, 0, 1))

        for i in range(self.numNPCs):
            el = []
            if self.npcs[i].playerTeam != self.player.playerTeam:
                el.append(self.player)
            for j in range(self.numNPCs):
                if self.npcs[i].playerTeam != self.npcs[j].playerTeam:
                    el.append(self.npcs[j])
            self.npcs[i].setEnemies(el)


        number = OnscreenText(
            text = "",
            scale = 0.75,
            pos = (0, -0.1875),
            fg = (1,1,1,1),
            align = TextNode.ACenter)

        def startSingleplayer():
            number.destroy()
            self.world.run()
            self.player.run()
            for npc in self.npcs:
                npc.run()
            taskMgr.add(self.checkGameOver, "checkGameOver")

        def setNumber(num):
            number["text"] = str(num)
            number["scale"] = 0.75
        inter = number.scaleInterval(1.0, 0)
        # setup a sequence that will count down for us
        self.countdownSeq = Sequence(
            Func(setNumber, 3),
            inter,
            Func(setNumber, 2),
            inter,
            Func(setNumber, 1),
            inter,
            Func(setNumber, "GO"),
            inter,
            Func(startSingleplayer))
        self.countdownSeq.start()

    def exitSingleplayer(self):
        self.countdownSeq.finish()
        self.player.stop()
        for i in range(len(self.npcs)):
            self.npcs[i].stop()
        self.npcs = []
        self.world.stop()
        del self.world
        self.gameResult.hide()
        taskMgr.remove("checkGameOver")
#.........这里部分代码省略.........
开发者ID:grimfang,项目名称:Paintball,代码行数:103,代码来源:fsmGame.py

示例6: InputBox

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import hide [as 别名]
# 
inputbox = InputBox(root, pos=(20, 200), size=(60, 20))
inputbox = InputBox(root, pos=(20, 250), size=(50, 20))
inputbox = InputBox(root, pos=(20, 300), size=(40, 20))
inputbox = InputBox(root, pos=(20, 350), size=(30, 20))

menu = Menu(root, level=1000, pos=(10, 10), margin=2, itemsize=(120, 28), vertical=True)
menu.add_item('bark1', barker('bark1'))
menu.add_item('bark2', barker('bark2'))
menu.add_item('bark3', barker('bark3'))
menu.add_item('bark3', barker('bark3'))
menu.add_item('bark3', barker('bark3'))
menu.add_item('bark3', barker('bark3'))
menu.add_item('bark3', barker('bark3'))
menu.add_item('bark3', barker('bark3'))
menu.hide()

def show_menu(event):
    if menu.is_visible():
        menu.pos = event.pos
    else:
        menu.pos = event.pos
        menu.show()

root.bind(EV_RCLICK, show_menu, BLK_POST_BLOCK)
root.bind(EV_CLICK, menu.hide, BLK_POST_BLOCK)

ser1 = Servo(root, sid=3, bias=512, size=(630, 100), pos=(100, 20), direction=1)
ser2 = Servo(root, sid=3, bias=512, size=(630, 100), pos=(100, 122), direction=1)
ser3 = Servo(root, sid=3, bias=512, size=(630, 100), pos=(100, 224), direction=1)
ser1 = Servo(root, sid=3, bias=512, size=(630, 100), pos=(100, 20), direction=1)
开发者ID:ZhanruiLiang,项目名称:servoflash,代码行数:33,代码来源:testui.py


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