gtk.Table

gtk.Table — layout widgets in a two-dimensional array

Synopsis

class gtk.Table(gtk.Container):
    gtk.Table(rows=1, columns=1, homogeneous=False)
def resize(rows, 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)
def set_row_spacing(row, spacing)
def get_row_spacing(row)
def set_col_spacing(column, spacing)
def get_col_spacing(column)
def set_row_spacings(spacing)
def get_default_row_spacing()
def set_col_spacings(spacing)
def get_default_col_spacing()
def set_homogeneous(homogeneous)
def get_homogeneous()

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.Container
        +-- gtk.Table

Implemented Interfaces

gtk.Table implements gtk.Buildable

gtk.Table Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

"column-spacing"Read-WriteThe amount of space between two adjacent columns
"homogeneous"Read-WriteIf True, the table cells are all the same width or height
"n-columns"Read-WriteThe number of columns in the table
"n-rows"Read-WriteThe number of rows in the table
"row-spacing"Read-WriteThe amount of space between two adjacent rows

gtk.Table Style Properties

gtk.Widget Style Properties

gtk.Table Child Properties

"bottom-attach"Read-WriteThe lowest row of the child
"left-attach"Read-WriteThe leftmost column of the child
"right-attach"Read-WriteThe rightmost column of the child
"top-attach"Read-WriteThe uppermost row of the child
"x-options"Read-Writethe horizontal behavior of the child - a combination of: gtk.EXPAND, gtk.SHRINK and gtk.FILL
"x-padding"Read-WriteExtra space added between the child widget and its left and right neighbors, in pixels
"y-options"Read-Writethe vertical behavior of the child - a combination of: gtk.EXPAND, gtk.SHRINK and gtk.FILL
"y-padding"Read-WriteExtra space added between the child widget and its top and bottom neighbors, in pixels

gtk.Table Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

Description

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.

Constructor

    gtk.Table(rows=1, columns=1, homogeneous=False)

rows :

the number of rows

columns :

the number of columns

homogeneous :

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.

Methods

gtk.Table.resize

    def resize(rows, columns)

rows :

The new number of rows.

columns :

The new number of columns.

The resize() method changes the size of the table as specified by the parameters, rows and columns.

gtk.Table.attach

    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)

child :

the widget to add.

left_attach :

the column number to attach the left side of a child widget to.

right_attach :

the column number to attach the right side of a child widget to.

top_attach :

the row number to attach the top side of a child widget to.

bottom_attach :

the row number to attach the bottom side of a child widget to.

xoptions :

used to specify the properties of the child widget when the table is resized horizontally.

yoptions :

used to specify the properties of the child widget when the table is resized vertically.

xpadding :

the amount of padding to add on the left and right of the widget

ypadding :

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 widget
  • right_attach - the column to the right of the widget
  • top_attach - the row above the widget and
  • bottom_attach - the row below the widget

The 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:

gtk.EXPAND

the table cell should expand to take up any extra space that has been allocated to the table.

gtk.SHRINK

the widget should shrink when the table cell shrinks.

gtk.FILL

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.

gtk.Table.set_row_spacing

    def set_row_spacing(row, spacing)

row :

the row number whose spacing will be changed.

spacing :

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.

gtk.Table.get_row_spacing

    def get_row_spacing(row)

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.

gtk.Table.set_col_spacing

    def set_col_spacing(column, spacing)

column :

the column number whose spacing will be changed.

spacing :

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.

gtk.Table.get_col_spacing

    def get_col_spacing(column)

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.

gtk.Table.set_row_spacings

    def set_row_spacings(spacing)

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.

gtk.Table.get_default_row_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())

gtk.Table.set_col_spacings

    def set_col_spacings(spacing)

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.

gtk.Table.get_default_col_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())

gtk.Table.set_homogeneous

    def set_homogeneous(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.

gtk.Table.get_homogeneous

    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)