Gtk.Table¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10) | 
|---|---|
| Structs: | Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5) | 
| class | new(rows, columns, homogeneous) | 
| attach(child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding) | |
| attach_defaults(widget, left_attach, right_attach, top_attach, bottom_attach) | |
| get_col_spacing(column) | |
| get_default_col_spacing() | |
| get_default_row_spacing() | |
| get_homogeneous() | |
| get_row_spacing(row) | |
| get_size() | |
| resize(rows, columns) | |
| set_col_spacing(column, spacing) | |
| set_col_spacings(spacing) | |
| set_homogeneous(homogeneous) | |
| set_row_spacing(row, spacing) | |
| set_row_spacings(spacing) | 
Virtual Methods¶
| Inherited: | Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10) | 
|---|
Properties¶
| Inherited: | Gtk.Container (3), Gtk.Widget (39) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| column-spacing | int | r/w | The amount of space between two consecutive columns | 
| homogeneous | bool | r/w | If True, the table cells are all the same width/height | 
| n-columns | int | r/w | The number of columns in the table | 
| n-rows | int | r/w | The number of rows in the table | 
| row-spacing | int | r/w | The amount of space between two consecutive rows | 
Child Properties¶
| Name | Type | Default | Flags | Short Description | 
|---|---|---|---|---|
| bottom-attach | int | 1 | r/w | The row number to attach the bottom of the child to | 
| left-attach | int | 0 | r/w | The column number to attach the left side of the child to | 
| right-attach | int | 1 | r/w | The column number to attach the right side of a child widget to | 
| top-attach | int | 0 | r/w | The row number to attach the top of a child widget to | 
| x-options | Gtk.AttachOptions | Gtk.AttachOptions.EXPAND|Gtk.AttachOptions.FILL | r/w | Options specifying the horizontal behaviour of the child | 
| x-padding | int | 0 | r/w | Extra space to put between the child and its left and right neighbors, in pixels | 
| y-options | Gtk.AttachOptions | Gtk.AttachOptions.EXPAND|Gtk.AttachOptions.FILL | r/w | Options specifying the vertical behaviour of the child | 
| y-padding | int | 0 | r/w | Extra space to put between the child and its upper and lower neighbors, in pixels | 
Style Properties¶
| Inherited: | Gtk.Widget (17) | 
|---|
Signals¶
| Inherited: | Gtk.Container (4), Gtk.Widget (69), GObject.Object (1) | 
|---|
Fields¶
| Inherited: | Gtk.Container (4), Gtk.Widget (69), GObject.Object (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| container | Gtk.Container | r | 
Class Details¶
- 
class Gtk.Table(*args, **kwargs)¶
- Bases: - Gtk.Container- Abstract: - No - Structure: - Gtk.TableClass- The - Gtk.Tablefunctions allow the programmer to arrange widgets 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.new(), the size of which can later be changed with- Gtk.Table.resize().- Widgets can be added to a table using - Gtk.Table.attach() or the more convenient (but slightly less flexible)- Gtk.Table.attach_defaults().- To alter the space next to a specific row, use - Gtk.Table.set_row_spacing(), and for a column,- Gtk.Table.set_col_spacing(). The gaps between all rows or columns can be changed by calling- Gtk.Table.set_row_spacings() or- Gtk.Table.set_col_spacings() respectively. Note that spacing is added between the children, while padding added by- Gtk.Table.attach() is added on either side of the widget it belongs to.- Gtk.Table.set_homogeneous(), can be used to set whether all cells in the table will resize themselves to the size of the largest widget in the table.- Gtk.Tablehas been deprecated. Use- Gtk.Gridinstead. It provides the same capabilities as- Gtk.Tablefor arranging widgets in a rectangular grid, but does support height-for-width geometry management.- 
classmethod new(rows, columns, homogeneous)[source]¶
- Parameters: - Returns: - A pointer to the newly created table widget. - Return type: - Used to create a new table widget. An initial size must be given by specifying how many rows and columns the table should have, although this can be changed later with - Gtk.Table.resize(). rows and columns must both be in the range 1 .. 65535. For historical reasons, 0 is accepted as well and is silently interpreted as 1.- Deprecated since version 3.4: Use - Gtk.Grid.new().
 - 
attach(child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding)[source]¶
- Parameters: - child (Gtk.Widget) – The widget to add.
- left_attach (int) – the column number to attach the left side of a child widget to.
- right_attach (int) – the column number to attach the right side of a child widget to.
- top_attach (int) – the row number to attach the top of a child widget to.
- bottom_attach (int) – the row number to attach the bottom of a child widget to.
- xoptions (Gtk.AttachOptions) – Used to specify the properties of the child widget when the table is resized.
- yoptions (Gtk.AttachOptions) – The same as xoptions, except this field determines behaviour of vertical resizing.
- xpadding (int) – An integer value specifying the padding on the left and right of the widget being added to the table.
- ypadding (int) – The amount of padding above and below the child widget.
 - Adds a widget to a table. The number of “cells” that a widget will occupy is specified by left_attach, right_attach, top_attach and bottom_attach. These each represent the leftmost, rightmost, uppermost and lowest column and row numbers of the table. (Columns and rows are indexed from zero). - To make a button occupy the lower right cell of a 2x2 table, use - gtk_table_attach (table, button, 1, 2, // left, right attach 1, 2, // top, bottom attach xoptions, yoptions, xpadding, ypadding); - If you want to make the button span the entire bottom row, use left_attach == 0 and right_attach = 2 instead. - Deprecated since version 3.4: Use - Gtk.Grid.attach() with- Gtk.Grid. Note that the attach arguments differ between those two functions.
- child (
 - 
attach_defaults(widget, left_attach, right_attach, top_attach, bottom_attach)[source]¶
- Parameters: - widget (Gtk.Widget) – The child widget to add.
- left_attach (int) – The column number to attach the left side of the child widget to.
- right_attach (int) – The column number to attach the right side of the child widget to.
- top_attach (int) – The row number to attach the top of the child widget to.
- bottom_attach (int) – The row number to attach the bottom of the child widget to.
 - As there are many options associated with - Gtk.Table.attach(), this convenience function provides the programmer with a means to add children to a table with identical padding and expansion options. The values used for the- Gtk.AttachOptionsare- GTK_EXPAND | GTK_FILL, and the padding is set to 0.- Deprecated since version 3.4: Use - Gtk.Grid.attach() with- Gtk.Grid. Note that the attach arguments differ between those two functions.
- widget (
 - 
get_col_spacing(column)[source]¶
- Parameters: - column ( - int) – a column in the table, 0 indicates the first column- Returns: - the column spacing - Return type: - int- Gets the amount of space between column col, and column col + 1. See - Gtk.Table.set_col_spacing().- Deprecated since version 3.4: - Gtk.Griddoes not offer a replacement for this functionality.
 - 
get_default_col_spacing()[source]¶
- Returns: - the default column spacing - Return type: - int- Gets the default column spacing for the table. This is the spacing that will be used for newly added columns. (See - Gtk.Table.set_col_spacings())- Deprecated since version 3.4: Use - Gtk.Grid.get_column_spacing() with- Gtk.Grid.
 - 
get_default_row_spacing()[source]¶
- Returns: - the default row spacing - Return type: - int- Gets the default row spacing for the table. This is the spacing that will be used for newly added rows. (See - Gtk.Table.set_row_spacings())- Deprecated since version 3.4: Use - Gtk.Grid.get_row_spacing() with- Gtk.Grid.
 - 
get_homogeneous()[source]¶
- Returns: - Trueif the cells are all constrained to the same size- Return type: - bool- Returns whether the table cells are all constrained to the same width and height. (See - Gtk.Table.set_homogeneous())- Deprecated since version 3.4: Use - Gtk.Grid.get_row_homogeneous() and- Gtk.Grid.get_column_homogeneous() with- Gtk.Grid.
 - 
get_row_spacing(row)[source]¶
- Parameters: - row ( - int) – a row in the table, 0 indicates the first row- Returns: - the row spacing - Return type: - int- Gets the amount of space between row row, and row row + 1. See - Gtk.Table.set_row_spacing().- Deprecated since version 3.4: - Gtk.Griddoes not offer a replacement for this functionality.
 - 
get_size()[source]¶
- Returns: - rows: - return location for the number of rows, or - None- columns: - return location for the number of columns, or - None- Return type: - (rows: - int, columns:- int)- Gets the number of rows and columns in the table. - New in version 2.22. - Deprecated since version 3.4: - Gtk.Griddoes not expose the number of columns and rows.
 - 
resize(rows, columns)[source]¶
- Parameters: - If you need to change a table’s size after it has been created, this function allows you to do so. - Deprecated since version 3.4: - Gtk.Gridresizes automatically.
 - 
set_col_spacing(column, spacing)[source]¶
- Parameters: - Alters the amount of space between a given table column and the following column. - Deprecated since version 3.4: Use - Gtk.Widget.set_margin_start() and- Gtk.Widget.set_margin_end() on the widgets contained in the row if you need this functionality.- Gtk.Griddoes not support per-row spacing.
 - 
set_col_spacings(spacing)[source]¶
- Parameters: - spacing ( - int) – the number of pixels of space to place between every column in the table.- Sets the space between every column in self equal to spacing. - Deprecated since version 3.4: Use - Gtk.Grid.set_column_spacing() with- Gtk.Grid.
 - 
set_homogeneous(homogeneous)[source]¶
- Parameters: - homogeneous ( - bool) – Set to- Trueto ensure all table cells are the same size. Set to- Falseif this is not your desired behaviour.- Changes the homogenous property of table cells, ie. whether all cells are an equal size or not. - Deprecated since version 3.4: Use - Gtk.Grid.set_row_homogeneous() and- Gtk.Grid.set_column_homogeneous() with- Gtk.Grid.
 - 
set_row_spacing(row, spacing)[source]¶
- Parameters: - Changes the space between a given table row and the subsequent row. - Deprecated since version 3.4: Use - Gtk.Widget.set_margin_top() and- Gtk.Widget.set_margin_bottom() on the widgets contained in the row if you need this functionality.- Gtk.Griddoes not support per-row spacing.
 - 
set_row_spacings(spacing)[source]¶
- Parameters: - spacing ( - int) – the number of pixels of space to place between every row in the table.- Sets the space between every row in self equal to spacing. - Deprecated since version 3.4: Use - Gtk.Grid.set_row_spacing() with- Gtk.Grid.
 
- 
classmethod 
Property Details¶
- 
Gtk.Table.props.column_spacing¶
- Name: - column-spacing- Type: - int- Default Value: - 0- Flags: - READABLE,- WRITABLE- The amount of space between two consecutive columns 
- 
Gtk.Table.props.homogeneous¶
- Name: - homogeneous- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE- If - True, the table cells are all the same width/height
- 
Gtk.Table.props.n_columns¶
- Name: - n-columns- Type: - int- Default Value: - 1- Flags: - READABLE,- WRITABLE- The number of columns in the table