[Urwid] multiple edit fields

Ian Ward ian at excess.org
Thu Jun 22 17:16:22 EDT 2006


Eric S. Johansson wrote:
> Ian Ward wrote:
>> The tour example just creates a bunch of widgets and puts them in a 
>> ListBox.  What you need to do is create your Edit widgets first, keep 
>> a variable to reference them, then add them to the ListBox.  That way 
>> you can use your variables and set_edit_text() to change what they are 
>> displaying.
> 
> okay, displaying my cluelessness (i.e. a cut-and-paste monkey), you mean 
> something like this?

A better example is section 2 "Conversation Example" in the tutorial. 
Look at how they keep a reference to the edit widget so they can operate 
on it later. 2.3 and 2.4 in the tutorial show how this is done with a 
ListBox.

> from your description, it sounds like I should be inserting the results 
> of urwid.Edit into a list so they would be available to retrieve the 
> change data from.  there's a bunch of things that I don't understand in 
> the code, I just know it works.  For example why is the AttrWrap 
> necessary?  If I skip that out, I'm told that urwid.Edit has no __call__ 
> method.

Really?  That shouldn't happen.  Can you post an example program that 
raises that exception when you remove an AttrWrap?

Ian






More information about the Urwid mailing list