ToscaWidgets
ToscaWidgets is WSGI framework for building reusable web UI components in python. The system allows a web developer to use a complex widget in their application with ease - the internal complexity of the widget is hidden. This helps rapidly develop compelling web applications. It is in theory compatible with any other WSGI-based web framework (such as Pyramid or TurboGears). There is an extensive library of existing widgets.
ToscaWidgets is split into two major versions...
ToscaWidgets 1 is battle-hardened. It has been used for years in the TurboGears community. You can depend on it.
Stable. Older.
""" The most basic form with ToscaWidgets 1 """
import tw.forms as twf
movie_form = twf.TableForm(
'movie_form',
action='save_movie',
children=[
twf.HiddenField('id'),
twf.TextField('title'),
twf.TextField('year', size=4),
twf.CalendarDatePicker('release_date'),
twf.SingleSelectField('genera', options=[
'', 'Action', 'Comedy', 'Other'
]),
twf.TextArea('description'),
]
)
ToscaWidgets 2 is where all the new development is happening. It is approaching stable.
ZOMG New!
""" The most basic form with ToscaWidgets 2 """
import tw2.core as twc
import tw2.forms as twf
class MovieForm(twf.FormPage):
title = 'Movie'
class child(twf.TableForm):
id = twf.HiddenField()
title = twf.TextField(validator=twc.Required)
director = twf.TextField()
genres = twf.CheckBoxList(options=[
'Action', 'Comedy', 'Romance', 'Sci-fi'
])
class cast(twf.GridLayout):
extra_reps = 5
character = twf.TextField()
actor = twf.TextField()