MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / Tab

Class Tab

PySimpleGUI/PySimpleGUI.py:7251–7496  ·  view source on GitHub ↗

Tab Element is another "Container" element that holds a layout and displays a tab with text. Used with TabGroup only Tabs are never placed directly into a layout. They are always "Contained" in a TabGroup layout

Source from the content-addressed store, hash-verified

7249# Tab #
7250# ---------------------------------------------------------------------- #
7251class Tab(Element):
7252 """
7253 Tab Element is another "Container" element that holds a layout and displays a tab with text. Used with TabGroup only
7254 Tabs are never placed directly into a layout. They are always "Contained" in a TabGroup layout
7255 """
7256
7257 def __init__(self, title, layout, title_color=None, background_color=None, font=None, pad=None, p=None, disabled=False,
7258 border_width=None, key=None, k=None, tooltip=None, right_click_menu=None, expand_x=False, expand_y=False, visible=True, element_justification='left',
7259 image_source=None, image_subsample=None, image_zoom=None, metadata=None):
7260 """
7261 :param title: text to show on the tab
7262 :type title: (str)
7263 :param layout: The element layout that will be shown in the tab
7264 :type layout: List[List[Element]]
7265 :param title_color: color of the tab text (note not currently working on tkinter)
7266 :type title_color: (str)
7267 :param background_color: color of background of the entire layout
7268 :type background_color: (str)
7269 :param font: NOT USED in the tkinter port
7270 :type font: (str or (str, int[, str]) or None)
7271 :param pad: Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int)
7272 :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
7273 :param p: Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used
7274 :type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
7275 :param disabled: If True button will be created disabled
7276 :type disabled: (bool)
7277 :param border_width: NOT USED in tkinter port
7278 :type border_width: (int)
7279 :param key: Value that uniquely identifies this element from all other elements. Used when Finding an element or in return values. Must be unique to the window
7280 :type key: str | int | tuple | object
7281 :param k: Same as the Key. You can use either k or key. Which ever is set will be used.
7282 :type k: str | int | tuple | object
7283 :param tooltip: text, that will appear when mouse hovers over the element
7284 :type tooltip: (str)
7285 :param right_click_menu: A list of lists of Menu items to show when this element is right clicked. See user docs for exact format.
7286 :type right_click_menu: List[List[ List[str] | str ]]
7287 :param expand_x: If True the element will automatically expand in the X direction to fill available space
7288 :type expand_x: (bool)
7289 :param expand_y: If True the element will automatically expand in the Y direction to fill available space
7290 :type expand_y: (bool)
7291 :param visible: set visibility state of the element
7292 :type visible: (bool)
7293 :param element_justification: All elements inside the Tab will have this justification 'left', 'right', 'center' are valid values
7294 :type element_justification: (str)
7295 :param image_source: A filename or a base64 bytes of an image to place on the Tab
7296 :type image_source: str | bytes | None
7297 :param image_subsample: amount to reduce the size of the image. Divides the size by this number. 2=1/2, 3=1/3, 4=1/4, etc
7298 :type image_subsample: (int)
7299 :param image_zoom: amount to increase the size of the image. 2=twice size, 3=3 times, etc
7300 :type image_zoom: (int)
7301 :param metadata: User metadata that can be set to ANYTHING
7302 :type metadata: (Any)
7303 """
7304
7305 filename = data = None
7306 if image_source is not None:
7307 if isinstance(image_source, bytes):
7308 data = image_source

Callers 3

_create_main_windowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected