def build_widgets():
input1 = urwid.Edit('What is your name? ')
input2 = urwid.Edit('What is your quest? ')
input3 = urwid.Edit('What is the capital of Assyria? ')
inputs = [input1, input2, input3]
def update_clock(widget_ref):
widget = widget_ref()
if not widget:
# widget is dead; the main loop must've been destroyed
return
widget.set_text(datetime.now().isoformat())
# Schedule us to update the clock again in one second
loop.call_later(1, update_clock, widget_ref)
clock = urwid.Text('')
update_clock(weakref.ref(clock))
return urwid.Filler(urwid.Pile([clock] + inputs), 'top')
评论列表
文章目录