MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / pin

Function pin

PySimpleGUI/PySimpleGUI.py:13163–13190  ·  view source on GitHub ↗

Pin's an element provided into a layout so that when it's made invisible and visible again, it will be in the correct place. Otherwise it will be placed at the end of its containing window/column. The element you want to pin is the element that you'll be making visibile/invisible.

(elem, vertical_alignment=None, shrink=True, expand_x=None, expand_y=None)

Source from the content-addressed store, hash-verified

13161 return Canvas(size=(0, 0), pad=((h_pixels, 0), (v_pixels, 0)))
13162
13163def pin(elem, vertical_alignment=None, shrink=True, expand_x=None, expand_y=None):
13164 """
13165 Pin's an element provided into a layout so that when it's made invisible and visible again, it will
13166 be in the correct place. Otherwise it will be placed at the end of its containing window/column.
13167
13168 The element you want to pin is the element that you'll be making visibile/invisible.
13169
13170 The pin helper function also causes containers to shrink to fit the contents correct after something inside
13171 has changed visiblity. Note that setting a hardcoded size on your window can impact this ability to shrink.
13172
13173 :param elem: the element to put into the layout
13174 :type elem: Element
13175 :param vertical_alignment: Aligns elements vertically. 'top', 'center', 'bottom'. Can be shortened to 't', 'c', 'b'
13176 :type vertical_alignment: str | None
13177 :param shrink: If True, then the space will shrink down to a single pixel when hidden. False leaves the area large and blank
13178 :type shrink: bool
13179 :param expand_x: If True/False the value will be passed to the Column Elements used to make this feature
13180 :type expand_x: (bool)
13181 :param expand_y: If True/False the value will be passed to the Column Elements used to make this feature
13182 :type expand_y: (bool)
13183 :return: A column element containing the provided element
13184 :rtype: Column
13185 """
13186 if shrink:
13187 # return Column([[elem, Canvas(size=(0, 0),background_color=elem.BackgroundColor, pad=(0, 0))]], pad=(0, 0), vertical_alignment=vertical_alignment, expand_x=expand_x, expand_y=expand_y)
13188 return Column([[elem, Column([[]], pad=(0, 0))]], pad=(0, 0), vertical_alignment=vertical_alignment, expand_x=expand_x, expand_y=expand_y)
13189 else:
13190 return Column([[elem]], pad=(0, 0), vertical_alignment=vertical_alignment, expand_x=expand_x, expand_y=expand_y)
13191
13192
13193def vtop(elem_or_row, expand_x=None, expand_y=None, background_color=None):

Callers 2

__init__Method · 0.85
_create_main_windowFunction · 0.85

Calls 1

ColumnClass · 0.85

Tested by

no test coverage detected