Created
September 22, 2015 01:51
-
-
Save eevee/c4677f2fe66a20aa027a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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