I am creating a small urwid
app for my use, the structure is a Filler
which has a Pile
composed of several Text
filed, followed by a Divider
, an Edit
, another Divier
and finally a Text
:
Text1
Text2
Text3
Divide
>> Edit
Divide
Textout
Now, I want to replace Text1 .. Text3
with other Text
field, the exact number of those varies. I figure I should redraw the entire UI, but I got no response on draw_screen()
My class:
class main_ui(urwid.Filler):
def __init__(self):
self.body = welcom()
self.options = self.body.options
self.replay = self.body.replay
self.ask = self.body.ask
super(main_ui,self).__init__(self.body.pile,valign='top')
def paint(self):
super(main_ii,self).__init__(urwid.pile[urwid.Text('test')])
The welcom()
function generates the above fields, and options
is dict
that holds information I need
I run the loop like this
def refresh(_loop,_data):
m.new_point()
_loop.draw_screen()
_loop.set_alarm_in(2,refresh)
m = main_ui()
loop = urwid.MainLoop(m)
loop.set_alarm_in(2,refresh)
loop.run()
How can I update my ui?