Web Analytics Made Easy - Statcounter
Skip to content

TabGroup

TabGroup Element groups together your tabs into the group of tabs you see displayed in your window

TabGroup(
    layout,
    tab_location = None,
    title_color = None,
    selected_title_color = None,
    background_color = None,
    font = None,
    change_submits = False,
    enable_events = False,
    pad = None,
    border_width = None,
    theme = None,
    key = None,
    k = None,
    tooltip = None,
    visible = True,
    metadata = None
)

Parameter Descriptions

Name Type Default Description
background_color str None color of background area that tabs are located on
border_width int None width of border around element in pixels
change_submits bool False * DEPRICATED DO NOT USE. Use enable_events instead
enable_events bool False If True then switching tabs will generate an Event
font (str or (str, int[, str]) or None) None specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
k str or int or tuple or object None Same as the Key. You can use either k or key. Which ever is set will be used.
key str or int or tuple or object None 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
layout List[List[Tab]] Layout of Tabs. Different than normal layouts. ALL Tabs should be on first row
metadata Any None User metadata that can be set to ANYTHING
pad (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) None 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)
selected_title_color str None color of tab text when it is selected
tab_location str None location that tabs will be displayed. Choices are left, right, top, bottom, lefttop, leftbottom, righttop, rightbottom, bottomleft, bottomright, topleft, topright
theme enum None DEPRICATED - You can only specify themes using set options or when window is created. It's not possible to do it on an element basis
title_color str None color of text on tabs
tooltip str None text, that will appear when mouse hovers over the element
visible bool True DEPRECATED - Should you need to control visiblity for the TabGroup as a whole, place it into a Column element

Class Properties

This class has no public properties

Class Methods

 def add_row
 def expand
 def find_key_from_tab_name
 def get
 def get_stylesheet
 def layout
 def set_stylesheet
 def update

add_row

Not recommended user call. Used to add rows of Elements to the Frame Element.

add_row(
    args = *<1 or N objects>
)

Parameter Descriptions

Name Type Default Description
*args List[Element] The list of elements for this row

expand

WARNING - NOT USED IN PySimpleGUIQt port. Provided as dummy method

expand(
    expand_x = False,
    expand_y = False,
    expand_row = True
)

Parameter Descriptions

Name Type Default Description
expand_row bool True If True the row containing the element will also expand. Without this your element is "trapped" within the row
expand_x bool False If True Element will expand in the Horizontal directions
expand_y bool False If True Element will expand in the Vertical directions
RETURN None None

find_key_from_tab_name

Searches through the layout to find the key that matches the text on the tab. Implies names should be unique

find_key_from_tab_name(
    tab_name
)

Parameter Descriptions

Name Type Default Description
tab_name str name of a tab
RETURN key or None Returns the key or None if no key found

get

Returns the current value for the Tab Group, which will be the currently selected tab's KEY or the text on the tab if no key is defined. Returns None if an error occurs. Note that this is exactly the same data that would be returned from a call to Window.Read. Are you sure you are using this method correctly?

get()

Parameter Descriptions

Name Type Default Description
RETURN Any or None The key of the currently selected tab or the tab's text if it has no key

get_stylesheet

Returns the stylesheet for element's associated Qt Widget

get_stylesheet()

Parameter Descriptions

Name Type Default Description
RETURN str stylesheet

layout

Can use like the Window.Layout method, but it's better to use the layout parameter when creating

layout(
    rows
)

Parameter Descriptions

Name Type Default Description
rows List[List[Element]] The rows of Elements
RETURN Frame Used for chaining

set_stylesheet

Sets the stylesheet for a Qt Widget

set_stylesheet(
    stylesheet
)

Parameter Descriptions

Name Type Default Description
stylesheet str Stylesheet (string) to set stylesheet to

update

Changes some of the settings for the Tab Group Element. Must call Window.Read or Window.Finalize prior

Changes will not be visible in your window until you call window.read or window.refresh.

If you change visibility, your element may MOVE.

update(
    visible = None
)

Parameter Descriptions

Name Type Default Description
visible bool None set visibility state of the element (Default = True)