Web Analytics Made Easy - Statcounter
Skip to content

Application-wide Configuration / Settings

set_global_icon

Sets the icon which will be used any time a window is created if an icon is not provided when the window is created.

set_global_icon(
    icon
)

Parameter Descriptions

Name Type Default Description
icon bytes or str Either a Base64 byte string or a filename

set_options

set_options(
    icon = None,
    button_color = None,
    element_size = (None, None),
    button_element_size = (None, None),
    margins = (None, None),
    element_padding = (None, None),
    auto_size_text = None,
    auto_size_buttons = None,
    font = None,
    border_width = None,
    slider_border_width = None,
    slider_relief = None,
    slider_orientation = None,
    autoclose_time = None,
    message_box_line_width = None,
    progress_meter_border_depth = None,
    progress_meter_style = None,
    progress_meter_relief = None,
    progress_meter_color = None,
    progress_meter_size = None,
    text_justification = None,
    background_color = None,
    element_background_color = None,
    text_element_background_color = None,
    input_elements_background_color = None,
    input_text_color = None,
    scrollbar_color = None,
    text_color = None,
    element_text_color = None,
    debug_win_size = (None, None),
    window_location = (None, None),
    error_button_color = (None, None),
    tooltip_time = None,
    tooltip_font = None,
    use_ttk_buttons = None,
    ttk_theme = None,
    suppress_error_popups = None,
    suppress_raise_key_errors = None,
    suppress_key_guessing = None,
    warn_button_key_duplicates = False,
    enable_treeview_869_patch = None,
    enable_mac_notitlebar_patch = None,
    use_custom_titlebar = None,
    titlebar_background_color = None,
    titlebar_text_color = None,
    titlebar_font = None,
    titlebar_icon = None,
    user_settings_path = None,
    pysimplegui_settings_path = None,
    pysimplegui_settings_filename = None,
    keep_on_top = None,
    dpi_awareness = None,
    scaling = None,
    disable_modal_windows = None,
    force_modal_windows = None,
    tooltip_offset = (None, None),
    sbar_trough_color = None,
    sbar_background_color = None,
    sbar_arrow_color = None,
    sbar_width = None,
    sbar_arrow_width = None,
    sbar_frame_color = None,
    sbar_relief = None,
    alpha_channel = None,
    hide_window_when_creating = None,
    use_button_shortcuts = None,
    watermark_text = None,
    win_app_id = None
)

Parameter Descriptions

Name Type Default Description
alpha_channel float None Default alpha channel to be used on all windows
auto_size_buttons bool None True if Buttons in this Window should be sized to exactly fit the text on this.
auto_size_text bool None True if the Widget should be shrunk to exactly fit the number of chars to show
autoclose_time ??? None ???
background_color str None color of background
border_width int None width of border around element
button_color (str, str) or str None Color of the button (text, background)
button_element_size (int, int) (None, None) Size of button
debug_win_size (int, int) (None, None) window size
disable_modal_windows bool None If True then all windows, including popups, will not be modal windows (unless they've been set to FORCED using another option)
dpi_awareness bool None If True then will turn on DPI awareness (Windows only at the moment)
element_background_color str None element background color
element_padding (int, int or (int, int),(int,int)) (None, None) Default amount of padding to put around elements in window (left/right, top/bottom) or ((left, right), (top, bottom))
element_size (int, int) (None, None) element size (width, height) in characters
element_text_color str None Default color to use for Text elements
enable_mac_notitlebar_patch bool None If True then Windows with no titlebar use an alternative technique when tkinter version < 8.6.10
enable_treeview_869_patch bool None If True, then will use the treeview color patch for tk 8.6.9
error_button_color ??? (None, None) (Default = (None))
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
force_modal_windows bool None If True then all windows will be modal (the disable option will be ignored... all windows will be forced to be modal)
hide_window_when_creating bool None If True then alpha will be set to 0 while a window is made and moved to location indicated
icon bytes or str None Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO. Most portable is to use a Base64 of a PNG file. This works universally across all OS's
input_elements_background_color str None Default color to use for the background of input elements
input_text_color str None Default color to use for the text for Input elements
keep_on_top bool None If True then all windows will automatically be set to keep_on_top=True
margins (int, int) (None, None) (left/right, top/bottom) tkinter margins around outsize. Amount of pixels to leave inside the window's frame around the edges before your elements are shown.
message_box_line_width ??? None ???
progress_meter_border_depth ??? None ???
progress_meter_color ??? None ???
progress_meter_relief ??? None
progress_meter_size ??? None ???
progress_meter_style ??? None You can no longer set a progress bar style. All ttk styles must be the same for the window
pysimplegui_settings_filename str None default filename for the global PySimpleGUI user_settings
pysimplegui_settings_path str None default path for the global PySimpleGUI user_settings
sbar_arrow_color str None Scrollbar color of the arrow at the ends of the scrollbar (it looks like a button). Switches to background color when mouse is over
sbar_arrow_width int None Scrollbar width of the arrow on the scrollbar. It will potentially impact the overall width of the scrollbar
sbar_background_color str None Scrollbar color of the background of the arrow buttons at the ends AND the color of the "thumb" (the thing you grab and slide). Switches to arrow color when mouse is over
sbar_frame_color str None Scrollbar Color of frame around scrollbar (available only on some ttk themes)
sbar_relief str None Scrollbar relief that will be used for the "thumb" of the scrollbar (the thing you grab that slides). Should be a constant that is defined at starting with "RELIEF_" - RELIEF_RAISED, RELIEF_SUNKEN, RELIEF_FLAT, RELIEF_RIDGE, RELIEF_GROOVE, RELIEF_SOLID
sbar_trough_color str None Scrollbar color of the trough
sbar_width int None Scrollbar width in pixels
scaling float None Sets the default scaling for all windows including popups, etc.
scrollbar_color str None Default color to use for the slider trough
slider_border_width int None Width of the border around sliders
slider_orientation ??? None ???
slider_relief str None Type of relief to use for sliders
suppress_error_popups bool None If True then error popups will not be shown if generated internally to PySimpleGUI
suppress_key_guessing bool None If True then key errors won't try and find closest matches for you
suppress_raise_key_errors bool None If True then key errors won't be raised (you'll still get popup error)
text_color str None color of the text
text_element_background_color str None text element background color
text_justification 'left' or 'right' or 'center' None Default text justification for all Text Elements in window
titlebar_background_color str or None None If custom titlebar indicated by use_custom_titlebar, then use this as background color
titlebar_font (str or (str, int[, str]) or None) or None None If custom titlebar indicated by use_custom_titlebar, then use this as title font
titlebar_icon bytes or str None If custom titlebar indicated by use_custom_titlebar, then use this as the icon (file or base64 bytes)
titlebar_text_color str or None None If custom titlebar indicated by use_custom_titlebar, then use this as text color
tooltip_font str or Tuple[str, int] or Tuple[str, int, str] None font to use for all tooltips
tooltip_offset ((None, None) or (int, int)) (None, None) Offset to use for tooltips as a tuple. These values will be added to the mouse location when the widget was entered.
tooltip_time int None time in milliseconds to wait before showing a tooltip. Default is 400ms
ttk_theme str None Theme to use with ttk widgets. Choices (on Windows) include - 'default', 'winnative', 'clam', 'alt', 'classic', 'vista', 'xpnative'
use_button_shortcuts bool None If True then Shortcut Char will be used with Buttons
use_custom_titlebar bool None If True then a custom titlebar is used instead of the normal system titlebar
use_ttk_buttons bool None if True will cause all buttons to be ttk buttons
user_settings_path str None default path for user_settings API calls. Expanded with os.path.expanduser so can contain ~ to represent user
warn_button_key_duplicates bool False If True then duplicate Button Keys generate warnings (not recommended as they're expected)
watermark_text str None Set the text that will be used if a window is watermarked
win_app_id str None For Windows only. Sets string that's passed to Windows to control combining icons on taskbar. Default is " mycompany.myproduct.subproduct.version". Windows with same ID combine on taskbar. Change before creating a window to set that window's ID.
window_location (int, int) or None (None, None) Default location to place windows. Not setting will center windows on the display
RETURN None None