Urwid: how to select the whole row, not one column?

758 Views Asked by At

Im coding around this example and I dont understand how to select the whole line when I press up or down arrows.

1

There are 1 best solutions below

5
On BEST ANSWER

Because of Columns widget doesn't support multiple selection, you need to use your own container widget(it can be based on Columns with redefined render method), or just Text, for example this:

def __init__ (self, id, description):
    self.content = 'item %s: %s...' % (str(id), description[:25])
    self.item = urwid.AttrWrap(
        urwid.Text('item %s: %s' % (id, description)), 'body', 'focus'
        )
    super(ItemWidget, self).__init__(self.item)

works fine. Also if your need in padding, your can emulate it with string formatting.