本文整理汇总了Python中ui.UI.display_menu方法的典型用法代码示例。如果您正苦于以下问题:Python UI.display_menu方法的具体用法?Python UI.display_menu怎么用?Python UI.display_menu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui.UI
的用法示例。
在下文中一共展示了UI.display_menu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import display_menu [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()