-
Notifications
You must be signed in to change notification settings - Fork 1
API Reference
Create a sizer whose objects will be added in the direction specified by prim_dir. Its value can be either "horizontal" or "vertical".
If prim_limit is bigger than zero, after adding that number of objects, the next object will be added to a new row (if prim_dir equals "horizontal") or column.
The amount (in pixels) of horizontal and/or vertical space to be added between the columns and/or rows of this sizer is specified with the gaps parameter. Default is (0, 0).
This method will destroy all of the cells and their objects as well.
It is usually not necessary to call this method directly; it gets called automatically when removing this sizer's cell using Sizer.remove_cell(cell, destroy=True) from the containing sizer.
Remove all cells from this sizer, optionally destroying them as well as the objects they contain.
add(obj: Widget|Sizer|int tuple, proportions: float tuple, alignments: str tuple, borders: int tuple, index: int) -> SizerCell
Append (if index is None) or insert either a Widget or Sizer instance or a (width, height) tuple (empty space).
A SizerCell will be created to "contain" the given object. This cell will have the width of its column and the height of its row. To make that column and/or row take up a certain amount of the space available to this sizer, a horizontal and/or vertical proportion can be requested which will be associated with the cell. What proportions will ultimately be used for the column/row depends on those associated with other cells and those set explicitly for that column/row. The default value for proportions is (0.0, 0.0).
With the alignments parameter, the given object can be set to expand so it takes up all of its cell's width and/or height, or it can be aligned to the cell in several ways. The possible values (for both the horizontal and the vertical direction) are:
-
"expand"(the default) -
"min"(left-aligned for horizontal sizers, top-aligned for vertical sizers) -
"max"(right-aligned for horizontal sizers, bottom-aligned for vertical sizers) "center"
The given object can also be given different borders; these are the offsets (in pixels) from the left, right, bottom and top sides of its cell.
Append (if index is None) or insert a cell that does not currently belong to any sizer.
Remove the given cell from this sizer, optionally destroying it and the object it contains.
Return a list of all the Widget instances (and their descendant widgets if include_children is True) whose layout is controlled by this sizer.
This method can be called to force or prevent a recalculation of the minimum size of this sizer when update_min_size is called.
Use with caution.
Recalculate the minimum size of this sizer.
This method should usually not be called by application code, as this is the task of the containing sizer.
Check whether a vertical proportion has been explicitly set for the row with the given index.
Return the vertical proportion that has been explicitly set for the row with the given index.
It is an error to call this if has_row_proportion(index) returns False.
Explicitly set a vertical proportion for the row with the given index. It will override the vertical proportions associated with any cell added to that row.
Remove the vertical proportion that has been explicitly set for the row with the given index.
This undoes the effect of a previous call to set_row_proportion for that row; its new vertical proportion will be the largest one of those associated with its cells.
Remove the vertical proportions that were explicitly set for any of the rows of this sizer.
See clear_row_proportion.
Check whether a horizontal proportion has been explicitly set for the column with the given index.
Return the horizontal proportion that has been explicitly set for the column with the given index.
It is an error to call this if has_column_proportion(index) returns False.
Explicitly set a horizontal proportion for the column with the given index. It will override the horizontal proportions associated with any cell added to that column.
Remove the horizontal proportion that has been explicitly set for the column with the given index.
This undoes the effect of a previous call to set_column_proportion for that column; its new horizontal proportion will be the largest one of those associated with its cells.
Remove the horizontal proportions that were explicitly set for any of the columns of this sizer.
See clear_column_proportion.
Remove the proportions that were explicitly set for any of the rows and columns of this sizer.
See clear_row_proportion and clear_column_proportion.
Set the width and height of this sizer and all of the objects controlled by it.
This method should usually not be called by application code, as this is the task of the containing sizer.
Return the width and height of this sizer.
Set the new pixel coordinates of this sizer.
This method should usually not be called by application code, as this is the task of the containing sizer.
Return the current (x, y) pixel coordinates of this sizer.
Update the coordinates of this sizer and all of the objects controlled by it.
This method should usually not be called by application code, as this is the task of the containing sizer.
Update the minimum size, the actual size and the coordinates of this sizer and all of the objects controlled by it.
This method should usually be called on the main sizer associated with the window, whenever this window is resized.
prim_dir -> str: the primary direction in which objects are added to this sizer.
prim_limit -> int: the maximum number of objects that can be added along the primary direction of this sizer.
gaps -> int tuple: the horizontal and vertical space between the columns and rows of this sizer.
owner -> Sizer|Widget: the object that this sizer belongs to (either it's a sub-sizer or it's assigned to a widget).
owner_widget -> Widget: the widget that this sizer ultimately belongs to (directly assigned to or as a sub-sizer).
sizer_cell -> SizerCell: the cell that this sizer is contained in (if it's a sub-sizer).
default_size -> int tuple: the minimum size of this sizer without any cells.
min_size -> int tuple: the minimum size of this sizer needed to accommodate all of its cells.
cells -> list: the cells in this sizer.