本文整理匯總了Python中urwid.AsyncioEventLoop方法的典型用法代碼示例。如果您正苦於以下問題:Python urwid.AsyncioEventLoop方法的具體用法?Python urwid.AsyncioEventLoop怎麽用?Python urwid.AsyncioEventLoop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類urwid
的用法示例。
在下文中一共展示了urwid.AsyncioEventLoop方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_app_in_loop
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import AsyncioEventLoop [as 別名]
def get_app_in_loop(pallete):
screen = urwid.raw_display.Screen()
screen.set_terminal_properties(256)
screen.register_palette(pallete)
ui = UI(urwid.SolidFill())
decorated_ui = urwid.AttrMap(ui, "root")
loop = ThreadSafeLoop(decorated_ui, screen=screen, event_loop=urwid.AsyncioEventLoop(),
handle_mouse=False)
ui.loop = loop
return loop, ui
示例2: __init__
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import AsyncioEventLoop [as 別名]
def __init__(self, loop):
base = urwid.SolidFill("")
self.loop = urwid.MainLoop(
base,
event_loop=urwid.AsyncioEventLoop(loop=loop),
palette=palettes)
self.base = base
示例3: renderScreen
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import AsyncioEventLoop [as 別名]
def renderScreen(self):
if __name__ == '__main__': # for testing purposes don't render outside file
if self.mL == None:
self.mL = urwid.MainLoop(self.body,
self.palette,
screen=self.screen,
# event_loop=urwid.AsyncioEventLoop(loop=loop),
unhandled_input=self.handleKey,
pop_ups=True)
self.mL.set_alarm_in(30, self.watcherUpdate)
self.mL.run()
else:
self.mL.widget = self.body
# self.mL.draw_screen()
示例4: create
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import AsyncioEventLoop [as 別名]
def create(cls, app, user):
"""Factory method, sets up TUI and an event loop."""
tui = cls(app, user)
loop = urwid.MainLoop(
tui,
palette=PALETTE,
event_loop=urwid.AsyncioEventLoop(),
unhandled_input=tui.unhandled_input,
)
tui.loop = loop
return tui
示例5: __init__
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import AsyncioEventLoop [as 別名]
def __init__(self, discord_client):
self.discord = discord_client
self.tabs = {}
self.w_tabs = TabSelector(self)
self.frame = urwid.Frame(
urwid.Filler(
urwid.Text(
"░█▀▄░▀█▀░█▀▀░█▀▀░█░█░█▀▄░█▀▀░█▀▀░█▀▀\n"
"░█░█░░█░░▀▀█░█░░░█░█░█▀▄░▀▀█░█▀▀░▀▀█\n"
"░▀▀░░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀\n"
f" v{__version__}\n"
" \n"
" \n"
" < Logging in... Hang tight! > \n"
" --------------------------- \n"
" \ ^__^ \n"
" \ (oo)\_______ \n"
" (__)\ )\/\ \n"
" ||----w | \n"
" || || \n"
" \n"
" \n"
" \n",
align=urwid.CENTER)),
header=self.w_tabs)
HasModal.__init__(self, self.frame)
self.urwid_loop = urwid.MainLoop(
self._w_placeholder,
palette=MainUI.palette,
unhandled_input=lambda key: self._keypress(None, key),
event_loop=urwid.AsyncioEventLoop(loop=self.discord.loop),
pop_ups=True)
def refresh(_loop, _data):
_loop.draw_screen()
_loop.set_alarm_in(2, refresh)
self.urwid_loop.set_alarm_in(0.2, refresh)
self.urwid_loop.start()