[Urwid] Columns container don't change focus, is it normal ?

Ian Ward ian at excess.org
Tue Jan 28 20:39:14 EST 2014


On Tue, Jan 28, 2014 at 1:12 PM, Goffi <goffi at goffi.org> wrote:
> G'day,
>
> I have a small question with the new behaviour with Columns.contents.
>
> I create a Columns container with just a Text Widget (so it's not selectable).
> columns.focus = 0 once created.
>
> After that, I append a selectable widget (say an EditBox):
>
> columns.contents.append((edit_box, columns.options()))
>
> but the focus doesn't change and the columns stay not selectable. I would
> expect that when there is no selectable widget in a Columns container, if I
> had one it take focus and columns become selectable.
>
> I can do it manually something, just after append widget to columns:
> if not columns.selectable() and widget.selectable():
>     columns.focus_position = len(columns.contents)-1
>
> So do I do something wrong and is the behaviour normal ?

Yes, this is the normal behaviour. The only time Columns will scan
through the widgets for a selectable widget is when it is created,
after that you would need to change the focus yourself.

Maybe this should be changed for the Columns, Pile and GridFlow
widgets when their focus is not selectable. What about edge cases like
a selectable widget that becomes unselectable?



More information about the Urwid mailing list