Dynamic HTML controls

Diez B. Roggisch deets at nospam.web.de
Tue Jan 12 10:11:40 CET 2010

Alan Harris-Reid schrieb:
> Hi,
> Does anyone know where I can find any decent dynamically-constructed 
> HTML control classes (dropdown list, table, input field, checkbox, etc.) 
> written in Python.  For example, for a HTML table I would like something 
> like...
> MyTable = html_table()       # instantiate class
> MyTable.data = data_list    # data-list (eg. cursor from SQL SELECT 
> statement)
> MyTable.border = 1          MyTable.width = 987  MyTable.column_headers 
> = col_headers    # list or tuple of column-headers table_code = 
> MyTable.table.create()           # returns string containing appropriate 
> HTML code
> I don't mind writing my own classes (it will be good practice for me), 
> but I don't want to re-invent the wheel if it can be avoided.

Maybe toscawidgets is for you, it has a lot of additional features such 
as static dependency declaration & injection.

For a form within a table, it would look like this:

table_form = TableForm("table_form",
                        fields=[SingleSelectField("foo", options=["A", 
"B", "C"]), action="/some/action", method="GET")



More information about the Python-list mailing list