Skip to content

Instantly share code, notes, and snippets.

@eevee
Created September 22, 2015 01:51
Show Gist options
  • Save eevee/c4677f2fe66a20aa027a to your computer and use it in GitHub Desktop.
Save eevee/c4677f2fe66a20aa027a to your computer and use it in GitHub Desktop.
import datetime
import urwid
top = urwid.Filler(urwid.Text("this is\nfour lines\nof text\n."))
bottom_walker = urwid.SimpleListWalker([])
bottom = urwid.ListBox(bottom_walker)
main = urwid.Pile([
(4, top),
bottom,
], focus_item=bottom)
def add_to_bottom(loop, data):
bottom_walker.append(urwid.Text(
"wow some new text, amazing @ {}"
.format(datetime.datetime.utcnow())
))
bottom_walker.set_focus(len(bottom_walker) - 1)
loop.set_alarm_in(1, add_to_bottom)
loop = urwid.MainLoop(main)
add_to_bottom(loop, None)
loop.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment