Python urwid.AsyncioEventLoop() Examples
The following are 5
code examples of urwid.AsyncioEventLoop().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
urwid
, or try the search function
.
Example #1
Source File: ui.py From sen with MIT License | 5 votes |
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
Example #2
Source File: ui.py From tildemush with GNU General Public License v3.0 | 5 votes |
def __init__(self, loop): base = urwid.SolidFill("") self.loop = urwid.MainLoop( base, event_loop=urwid.AsyncioEventLoop(loop=loop), palette=palettes) self.base = base
Example #3
Source File: TerminusBrowser.py From TerminusBrowser with BSD 3-Clause "New" or "Revised" License | 5 votes |
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()
Example #4
Source File: app.py From toot with GNU General Public License v3.0 | 5 votes |
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
Example #5
Source File: main.py From Discurses with MIT License | 4 votes |
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()