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


Python UI.window方法代码示例

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


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

示例1: main

# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import window [as 别名]
def main():
    """
    The main method of the nuncium application will initialize the execution of
    the program. Threads will be used to query for user input. Each window has
    its own thread to manage the update of its own interface.
    """

    # UI object: The user interface of the nuncium application.
    ui = UI()

    # Integer: The height will consist of the entire screen and the width will
    #          consist of approximately 1/5 of the screen's width.
    height = curses.LINES
    width = int(curses.COLS / 5)

    # String: The default news category that is displayed on startup.
    category = "Top Stories"

    # Window object: The window that will render the menu interface.
    menu_window = ui.window(height, width)
    ui.display_menu(menu_window, category, color=curses.COLOR_BLUE)

    # Integer: The starting position in the x-coordinate of the news window will
    #          be rendered where the last window left off. The width of the news
    #          window will consist of the remaining free space.
    x = width
    width = curses.COLS - width

    # Window object: The window that will render the news content.
    news_window = ui.window(height, width, x, y=0)

    # News object: The news aggregator of the nunicum application.
    news = News()
    news.fetch_news(ui, news_window)

    ui.cursor(menu_window, x=1, y=1, y2=1, current="Top Stories")

    # Thread object: A thread used for updating the menu and news content.
    menu_thread = Thread(target=update, args=(menu_window,), daemon=True)
    news_thread = Thread(target=update, args=(news_window,), daemon=True)

    menu_thread.start()
    news_thread.start()

    # Wait for the threads to finish working.
    while running:
        pass

    ui.cleanup()
开发者ID:massimoca,项目名称:nuncium,代码行数:51,代码来源:nuncium.py


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