[Urwid] radio button magic
Eric S. Johansson
esj at harvee.org
Sun Jul 23 21:56:04 EDT 2006
Ian Ward wrote:
> Eric S. Johansson wrote:
>
>> the current quandary is after I select a radio button, the cursor
>> moves back to the green radio button no matter which radio button I
>> select. How I get the cursor to stay in the same position as the radio
>> button selection or maybe I should say forced reselection.
>>
>
> If you are using a GridFlow or Columns widget to arrange the radio
> buttons you can call its set_focus method to restore the focus to the
> correct radio button after you recreate the group of radio buttons.
>
> Alternatively you can avoid recreating the radio button group every time
> one of its items is selected. If you want help with that please post
> some code we can run (without downloading extra libraries).
I'll try to winnow it down to a reasonable size. The part of the
problem comes because I am trying to display some combination of four
buttons in a grid flow. I thought that rather than correlating which
elements in the grid flow list correspond to which color of interface
I'm working with, trashing the list and regenerating it would be easier.
in the morning I think of try to figure out if I can add extra
attributes to help with rearranging the list.
For what it's worth, the only time I change the radio buttons is when I
change the configuration return to me in a different part of the user
interface. Which reminds me, what's the best way of implementing a
selection box? I'm currently using an edit box where the user edits the
number to select a different configuration. failing a simple solution,
how about what is the best way to get just what the user has typed and
not the entire contents of the edit box? again, I just need a simple
single character integer 0-7.
More information about the Urwid
mailing list