gtk.Table — layout widgets in a two-dimensional array
class gtk.Table(gtk.Container): |
|
|
The gtk.Table
manages a
group of widgets that are arranged in rows and columns, making it easy to
align many widgets next to each other, horizontally and vertically. Tables
are created with a call to gtk.Table(). The size of a table can
be changed using the resize
()
method.
Widgets can be added to a table using the attach
()
method. To alter the space of the row next to a specific row, use the set_row_spacing
()
method, and for a column, the set_col_spacing
()
method. The gaps between all rows or columns can be changed by calling the
set_row_spacings
()
or set_col_spacings
()
methods respectively. The set_homogeneous
()
method changes the setting that determines whether all cells in the table
will resize themselves to the size of the largest widget in the
table.
gtk.Table(rows
=1, columns
=1, homogeneous
=False)
| the number of rows |
| the number of columns |
| if True all table cells will
be the same size as the largest cell |
Returns : | a new gtk.Table
widget |
Creates a new gtk.Table
widget with
the number of rows and columns specified by the value of
rows
and columns
respectively.
The value of rows
and columns
must be in the range 0 .. 65535. If homogeneous
is
True
the table cells will all be the same size as the
largest cell. If rows
or
columns
are not specified they default to 1.
def resize(rows
, columns
)
| The new number of rows. |
| The new number of columns. |
The resize
() method changes the size of
the table as specified by the parameters, rows
and
columns
.
def attach(child
, left_attach
, right_attach
, top_attach
, bottom_attach
, xoptions
=gtk.EXPAND|gtk.FILL, yoptions
=gtk.EXPAND|gtk.FILL, xpadding
=0, ypadding
=0)
| the widget to add. |
| the column number to attach the left side of a child widget to. |
| the column number to attach the right side of a child widget to. |
| the row number to attach the top side of a child widget to. |
| the row number to attach the bottom side of a child widget to. |
| used to specify the properties of the child widget when the table is resized horizontally. |
| used to specify the properties of the child widget when the table is resized vertically. |
| the amount of padding to add on the left and right of the widget |
| the amount of padding to add above and below the widget |
The attach
() method adds the widget
specified by child
to the table. The number of
'cells' that a widget will occupy is specified by:
left_attach
- the column to the
left of the widgetright_attach
- the column to the
right of the widgettop_attach
- the row above the
widget andbottom_attach
- the row below the
widgetThe xoptions
and
yoptions
determine the expansion properties of the
widget in the horizontal and vertical directions respectively (the default
value is gtk.FILL
|gtk.EXPAND
). The
value of the options is a combination of:
| the table cell should expand to take up any extra space that has been allocated to the table. |
| the widget should shrink when the table cell shrinks. |
| the widget should fill the space allocated to it in the table cell. |
The xpadding
and ypadding
parameters determine the extra padding added around the widget. By default these are 0.
def set_row_spacing(row
, spacing
)
| the row number whose spacing will be changed. |
| the number of pixels of added spacing |
The set_row_spacing
() method sets the
spacing in pixels (specified by spacing
) between the
specified row
and the following row.
def get_row_spacing(row
)
| a row in the table, 0 indicates the first row |
Returns : | the row spacing |
The get_row_spacing
() method returns
the amount of space between the specified row
, and
the following row. See the set_row_spacing
()
method.
def set_col_spacing(column
, spacing
)
| the column number whose spacing will be changed. |
| the number of pixels of added spacing |
The set_col_spacing
() method sets the
spacing in pixels (specified by spacing
) between the
specified column
and the following column.
def get_col_spacing(column
)
| a column in the table, 0 indicates the first column |
Returns : | the column spacing |
The get_col_spacing
() returns the
amount of space between the specified column
, and the
following column. See the set_col_spacing
()
method.
def set_row_spacings(spacing
)
| the number of pixels of space to place between every row in the table. |
The set_row_spacings
() method sets the
"row-spacing" property, that determines the space between every row in
table, to the value of spacing
.
def get_default_row_spacing()
Returns : | the default row spacing |
The get_default_row_spacing
() method
returns the value of the "row-spacing" property that specifies the default
row spacing for the table i.e. the spacing that will be used for newly added
rows. (See the set_row_spacings
())
def set_col_spacings(spacing
)
| the number of pixels of space to place between every column in the table. |
The set_col_spacings
() method sets the
"column-spacing" property, that determines the space between every column in
table, to the value of spacing
.
def get_default_col_spacing()
Returns : | the default column spacing |
The get_default_col_spacing
() method
returns the value of the "column-spacing" property to the default column
spacing for the table i.e. the spacing that will be used for newly added
columns. (See the set_col_spacings
())
def set_homogeneous(homogeneous
)
| if True all cells will be
the same size as the largest cell |
The set_homogeneous
() method sets the
"homogeneous" property to the value of homogeneous
. If
homogeneous is True
all cells will be the same size as the
largest cell.
def get_homogeneous()
Returns : | True if the cells are all
set to the same size |
The get_homogeneous
() method returns the
value of the "homogeneous" property. If the value of "homogeneous" is
True
all cells are set to the same width and height. (See
the set_homogeneous
()
method)