Class Table - Construct a Table with Python lists.
SYNOPSIS
import HTMLgen
class Table
def __init__(self, tabletitle='', **kw)
string __module__ = 'HTMLgen'
def __str__(self)
def get_body_color(self, colors, i)
DESCRIPTION
Instantiate with a string argument for the table's name (caption).
Set object.heading to a list of strings representing the column headings.
Set object.body to a list of lists representing rows. WARNING: the body
attribute will be edited to conform to html. If you don't want your
data changed make a copy of this list and use that with the table object.
Arg1 is a string title for the table caption, optional keyword
arguments follow.
Generates the html for the entire table.
Return bgcolor argument for column number i
Keyword Parameters
Defaults in (parenthesis). Keyword parameters may be set as attributes of the
instantiated table object as well.
- caption_align
- 'top'|'bottom' specifies the location of the table title ('top')
- border
- the width in pixels of the bevel effect around the table (2)
- cell_padding
- the distance between cell text and the cell boundary (4)
- cell_spacing
- the width of the cell borders themselves (1)
- width
- the width of the entire table wrt the current window width ('100%')
- colspan
- a list specifying the number of columns spanned by that heading
index. e.g. t.colspan = [2,2] will place 2 headings spanning
2 columns each (assuming the body has 4 columns).
- heading
- list of strings, the length of which determine the number of
columns. ( [' ']*3 )
- heading_align
- 'center'|'left'|'right'
horizontally align text in the header row ('center')
- heading_valign
- 'middle' |'top'|'bottom'
vertically align text in the header row ('middle')
- body_color
- a list of colors, for each column (None)
- heading_color
- a list of color for each column heading (None)
For both these the index used is i%len(..._color) so
the color cycles through the columns
- body
- a list of lists in row major order containing strings or objects
to populate the body of the table. ( [[' ']*3] )
- column1_align
- 'left'|'right'|'center' text alignment of the first column
- cell_align
- 'left'|'right'|'center' text alignment for all other cells
- cell_line_breaks
- 1|0 flag to determine if newline char in body text will be
converted to <br> symbols; 1 they will, 0 they won't. (1)
SEE ALSO
HTMLgen
Copyright © Robin Friedrich
All Rights Reserved
Comments to author: friedrich@pythonpros.com
Generated: Tue Apr 20, 1999