[Urwid] multiple edit fields

Eric S. Johansson esj at harvee.org
Thu Jun 22 12:08:14 EDT 2006


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?

def piled_data(color):
	color_dictionary = color_keys(color)
	color_list = color_dictionary.keys()
	color_list.sort()
	
	display_list =[]
	for list_element in color_list:
		data_element = color_dictionary[list_element]
		display_list.append(urwid.Padding(
			urwid.AttrWrap( urwid.Edit( data_element ), 'editbx', 'editfc'),
			('fixed left',2),
			('fixed right',0),
			20))
	print display_list
	return display_list

---------

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.

  Hope this helps.

it does.  I haven't quite got the basic mindset internalized yet what it 
will get their.  I just am on a bit of a short schedule for this 
particular project (aren't we all).

---eric

-- 
Speech-recognition in use.  It makes mistakes, I correct some.




More information about the Urwid mailing list