Web Analytics Made Easy - Statcounter
Skip to content

Checkbox

Checkbox(
    text,
    default = False,
    size = (None, None),
    auto_size_text = None,
    font = None,
    background_color = None,
    text_color = None,
    change_submits = False,
    enable_events = False,
    disabled = False,
    key = None,
    k = None,
    pad = None,
    tooltip = None,
    visible = True,
    size_px = (None, None),
    metadata = None
)

Parameter Descriptions

Name Type Default Description
auto_size_text bool None if True will size the element to match the length of the text
background_color str None color of background
change_submits bool False DO NOT USE. Only listed for backwards compat - Use enable_events instead
default bool False Set to True if you want this checkbox initially checked
disabled bool False set disable state
enable_events bool False Turns on the element specific events. Checkbox events happen when an item changes
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 Used with window.find_element and with return values to uniquely identify this element
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)
size (int, int) or (None, None) (None, None) (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1
size_px (int, int) or (None, None) (None, None) w=pixels-wide, h=pixels-high
text str Text to display next to checkbox
text_color str None color of the text
tooltip str None text, that will appear when mouse hovers over the element
visible bool True set visibility state of the element

Class Properties

This class has no public properties

Class Methods

 def expand
 def get
 def get_stylesheet
 def set_stylesheet
 def update

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

get

Return the current state of this checkbox

get()

Parameter Descriptions

Name Type Default Description
RETURN bool Current state of checkbox

get_stylesheet

Returns the stylesheet for element's associated Qt Widget

get_stylesheet()

Parameter Descriptions

Name Type Default Description
RETURN str stylesheet

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 Checkbox Element. Must call Window.Read or Window.Finalize prior. Note that changing visibility may cause element to change locations when made visible after invisible

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(
    value = None,
    disabled = None,
    background_color = None,
    text_color = None,
    font = None,
    visible = None
)

Parameter Descriptions

Name Type Default Description
background_color str None color of background
disabled bool None disable or enable element
text_color str None color of the text. Note this also changes the color of the checkmark
value bool None if True checks the checkbox, False clears it
visible bool None control visibility of element