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


Python Menu.display方法代码示例

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


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

示例1: __init__

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


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