-
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 controlled 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 from the containing sizer using Sizer.remove_cell(cell, destroy=True).
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.
add_cell(cell: SizerCell, index: int)
Append (if index is None) or insert a cell that does not currently belong to any sizer.
remove_cell(cell: SizerCell, destroy: bool)
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.
Return the proportions to be applied to any sizer's columns and rows when there is no explicitly set proportion and no proportions associated with any cells for those columns and/or rows.
Set the proportions to be applied to any sizer's columns and rows when there is no explicitly set proportion and no proportions associated with any cells for those columns and/or rows. The default value for both parameters is 0.0.
Return the proportions to be applied to this sizer's columns and rows when there is no explicitly set proportion and no proportions associated with any cells for those columns and/or rows.
Set the proportions to be applied to this sizer's columns and rows when there is no explicitly set proportion and no proportions associated with any cells for those columns and/or rows. The default value for both parameters is -1.0, meaning that the global defaults will be used instead.
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 (or the local or global default value if there are no proportions associated with any 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 (or the local or global default value if there are no proportions associated with any 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.
Return the width and height of this sizer.
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 current coordinates of this sizer.
Set the new coordinates of this sizer.
This method should usually not be called by application code, as this is the task of the containing 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.
type → str: "sizer".
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.
__init__(sizer: Sizer, obj: Widget|Sizer|int tuple, obj_type: str, proportions: float tuple, alignments: str tuple, borders: int tuple)
Create a cell to contain the given object obj.
SizerCell instances should never be created by application code, as they are automatically created when adding objects to a sizer.
Destroy this cell and the object it contains.
Recalculate the minimum size of this cell.
This method should usually not be called by application code, as this is the task of the containing sizer.
Set the width and height of this cell.
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 cell.
type → str: the type of the object in this cell ("widget", "sizer" or "size").
object → Widget|Sizer|int tuple: the object in this cell.
sizer → Sizer: the sizer that this cell belongs to.
proportions → float tuple: the proportions associated with this cell.
alignments → str tuple: the sides of this cell that its object is aligned to.
borders → int tuple: the offsets of this cell's object from the sides of the cell.
object_offset → int tuple: the left and top offsets of this cell's object.
min_size → int tuple: the minimum size of this cell needed to accommodate its object and the borders around it.
Create a widget to connect the given DirectGuiWidget dgui_obj to the layout system.
Destroy this widget and the DirectGuiWidget it is associated with.
It is usually not necessary to call this method directly; it gets called automatically when destroying the sizer cell it is contained in.
Set the width and height of this widget.
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 widget.
Set the new coordinates of this widget.
This method should usually not be called by application code, as this is the task of the containing sizer.
Return the current coordinates of this widget.
Calculate the new minimum size of this widget and call resetFrameSize() on the DirectGuiWidget it is associated with.
type → str: "widget".
sizer → Sizer: the sizer assigned to this widget.
sizer_cell → SizerCell: the sizer cell that this widget is contained in.
min_size → int tuple: the minimum size of this widget.
class ScrolledListWidget(Widget)
__init__(dgui_obj: DirectScrolledList, scrollbtn_proportion: float, scrollbtn_borders: int tuple, itemframe_borders: int tuple, margins: int tuple)
Create a widget to connect the given DirectScrolledList dgui_obj to the layout system.
The margins specify the left and right borders around the items in the frame.
Add the DirectGuiWidget item to this list.
The refresh parameter (default False) is passed to the DirectScrolledList.addItem method.
If expand is True (the default), the item will take up the available width of the frame.
Remove the DirectGuiWidget item from this list.
The refresh parameter (default False) is passed to the DirectScrolledList.removeItem method.
class ScrolledFrameWidget(Widget)
__init__(dgui_obj: DirectScrolledFrame, scroll_dir: str)
Create a widget to connect the given DirectScrolledFrame dgui_obj to the layout system.