本文整理汇总了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()