How to change ui to urwid

I am creating a small application urwidfor my use, a structure - Fillerin which there is Pile, consisting of several Text, followed by Dividera Edit, another Divierand finally a Text:

Text1
Text2
Text3
Divide
>> Edit
Divide
Textout

Now I want to replace with Text1 .. Text3another field Text, the exact number of which is changing. I suppose I should redraw the entire user interface, but I did not receive a response todraw_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 function welcom()generates the above fields, and options- dict, which contains the information that I need

I run such a cycle

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 do i update ui?

+4
source share

All Articles