[r4535]: projects / ToscaWidgets / trunk / docs / source / api.rst  Maximize  Restore  History

Download this file

93 lines (59 with data), 2.3 kB

Public API

Public symbols from the ToscaWidgets distribution should be imported from :mod:`tw.api`.

All ToscaWidgets widget eggs, such as tw.forms, etc. graft their namespaces in the :mod:`tw` namespace [1]. For example, to import form widgtes from :mod:`tw.forms` on would do:

from tw.forms import TextField, PasswordField


This is the base class all widgets should inherit from.

XXX: Explain state-less behaviour and why you can't setattr after initialization, etc...


This object is just syntax sugar to have a DSL-like way to declare a list of widgets. Although it's subclasses appear to have attributes, there's some metaclass magic behind the scenes which turns the class into a list factory.


Notice how we don't need to pass and id parameter and the widgets are sorted by ascending declaration time.


[1]This is accomplished using setuptools' namespace packages