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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
The amount of space between two consecutive columns |
||
r/w |
If |
||
r/w |
The number of columns in the table |
||
r/w |
The number of rows in the table |
||
r/w |
The amount of space between two consecutive rows |
Child Properties¶
Name |
Type |
Default |
Flags |
Short Description |
---|---|---|---|---|
|
|
r/w |
The row number to attach the bottom of the child to |
|
|
|
r/w |
The column number to attach the left side of the child to |
|
|
|
r/w |
The column number to attach the right side of a child widget to |
|
|
|
r/w |
The row number to attach the top of a child widget to |
|
|
r/w |
Options specifying the horizontal behaviour of the child |
||
|
|
r/w |
Extra space to put between the child and its left and right neighbors, in pixels |
|
|
r/w |
Options specifying the vertical behaviour of the child |
||
|
|
r/w |
Extra space to put between the child and its upper and lower neighbors, in pixels |
Style Properties¶
- Inherited:
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
container |
r |
Class Details¶
- class Gtk.Table(*args, **kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The
Gtk.Table
functions 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 withGtk.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 callingGtk.Table.set_row_spacings
() orGtk.Table.set_col_spacings
() respectively. Note that spacing is added between the children, while padding added byGtk.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.Table
has been deprecated. UseGtk.Grid
instead. It provides the same capabilities asGtk.Table
for 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
() withGtk.Grid
. Note that the attach arguments differ between those two functions.
- 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 theGtk.AttachOptions
areGTK_EXPAND | GTK_FILL
, and the padding is set to 0.Deprecated since version 3.4: Use
Gtk.Grid.attach
() withGtk.Grid
. Note that the attach arguments differ between those two functions.
- get_col_spacing(column)[source]¶
- Parameters:
column (
int
) – a column in the table, 0 indicates the first column- Returns:
the column spacing
- Return type:
Gets the amount of space between column col, and column col + 1. See
Gtk.Table.set_col_spacing
().Deprecated since version 3.4:
Gtk.Grid
does not offer a replacement for this functionality.
- get_default_col_spacing()[source]¶
- Returns:
the default column spacing
- Return type:
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
() withGtk.Grid
.
- get_default_row_spacing()[source]¶
- Returns:
the default row spacing
- Return type:
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
() withGtk.Grid
.
- get_homogeneous()[source]¶
-
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
() andGtk.Grid.get_column_homogeneous
() withGtk.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:
Gets the amount of space between row row, and row row + 1. See
Gtk.Table.set_row_spacing
().Deprecated since version 3.4:
Gtk.Grid
does not offer a replacement for this functionality.
- get_size()[source]¶
- Returns:
- Return type:
Gets the number of rows and columns in the table.
New in version 2.22.
Deprecated since version 3.4:
Gtk.Grid
does not expose the number of columns and rows.
- resize(rows, columns)[source]¶
-
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.Grid
resizes 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
() andGtk.Widget.set_margin_end
() on the widgets contained in the row if you need this functionality.Gtk.Grid
does 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
() withGtk.Grid
.
- set_homogeneous(homogeneous)[source]¶
- Parameters:
homogeneous (
bool
) – Set toTrue
to ensure all table cells are the same size. Set toFalse
if 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
() andGtk.Grid.set_column_homogeneous
() withGtk.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
() andGtk.Widget.set_margin_bottom
() on the widgets contained in the row if you need this functionality.Gtk.Grid
does 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
() withGtk.Grid
.
Property Details¶
- Gtk.Table.props.column_spacing¶
-
The amount of space between two consecutive columns
- Gtk.Table.props.n_columns¶
-
The number of columns in the table
- Gtk.Table.props.n_rows¶
-
The number of rows in the table