5 class Form(widget
.Widget
):
6 """A form that automatically will contain all named widgets.
8 <p>After a form is created, all named widget that are subsequently created are added
9 to that form. You may use dict style access to access named widgets.</p>
13 <strong>Example</strong>
17 w = gui.Input("Phil",name="firstname")
18 w = gui.Input("Hassey",name="lastname")
24 print f['firstname'].value
25 print f['lastname'].value
30 widget
.Widget
.__init
__(self
,decorate
=False)
36 def add(self
,e
,name
=None,value
=None):
37 if name
!= None: e
.name
= name
38 if value
!= None: e
.value
= value
43 for e
in self
._elist
[:]:
44 if not hasattr(e
,'name') or e
.name
== None:
48 self
._emap
[e
.name
] = e
51 def __getitem__(self
,k
):
52 if self
._dirty
: self
._clean
()
55 def __contains__(self
,k
):
56 if self
._dirty
: self
._clean
()
57 if k
in self
._emap
: return True
61 """Return a dict of name => values.
63 <pre>Form.results(): return dict</pre>
65 if self
._dirty
: self
._clean
()
72 """Return a list of name, value keys.
74 <pre>Form.items(): return list</pre>
76 return self
.results().items()
79 # Object.start(self,-1)