PySimpleGUI/readme_creator/markdown input files/5_call_reference.md

56 KiB

LOGO

ELEMENT AND FUNCTION CALL REFERENCE

Here you will find the details for all Elements, Objects, and Functions that are available to you. If you want to use a complex element and don't understand the parameters, then this is the right place to come. For every element you're shown the parameters used to create it as well as all methods available to call.

Currently PySimpleGUI (tkinter) only

This documentation is created using the PySimpleGUI.py file which means it's based on the tkinter code. Some of the calls are different, might not exist at all, or there may be more methods/functions for the other PySimpleGUI ports (Qt, Wx, Web).

Work is underway to get the PySimpleGUIQt docstrings completed and corrected.

Caution - Some functions / methods may be internal only yet exposed in this documentation

This section of the documentation is generated directly from the source code. As a result, sometimes internal only functions or methods that you are not supposed to be calling are accidently shown in this documentation. Hopefully these accidents don't happen often.

Here are all of the Elements, the Window & SystemTray classes, and all functions


Button Element

bind

block_focus

click

expand

get_size

get_text

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

set_vscroll_position

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Click

GetText

SetFocus

SetTooltip

Update


ButtonMenu Element

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

set_vscroll_position

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Click

SetFocus

SetTooltip

Update


Canvas Element

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

tk_canvas

unbind

unhide_row

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip

TKCanvas


Checkbox Element

bind

block_focus

expand

get

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Get

SetFocus

SetTooltip

Update


Column Element

add_row

bind

block_focus

contents_changed

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

layout

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

set_vscroll_position

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

AddRow

Layout

SetFocus

SetTooltip

Update


Combo Element

bind

block_focus

expand

get

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Get

SetFocus

SetTooltip

Update


Frame Element

add_row

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

layout

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

AddRow

Layout

SetFocus

SetTooltip

Update


Graph Element

Update

bind

block_focus

bring_figure_to_front

change_coordinates

delete_figure

draw_arc

draw_circle

draw_image

draw_line

draw_oval

draw_point

draw_polygon

draw_rectangle

draw_text

erase

expand

get_bounding_box

get_figures_at_location

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

move

move_figure

relocate_figure

send_figure_to_back

metadata

set_cursor

set_focus

set_size

set_tooltip

tk_canvas

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

BringFigureToFront

DeleteFigure

DrawArc

DrawCircle

DrawImage

DrawLine

DrawOval

DrawPoint

DrawPolygon

DrawRectangle

DrawText

Erase

GetBoundingBox

GetFiguresAtLocation

Move

MoveFigure

RelocateFigure

SendFigureToBack

SetFocus

SetTooltip

TKCanvas


HorizontalSeparator Element

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip


Image Element

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

update_animation

update_animation_no_buffering

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip

Update

UpdateAnimation


Input Element

bind

block_focus

expand

get

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

set_vscroll_position

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Get

SetFocus

SetTooltip

Update


Listbox Element

bind

block_focus

expand

get

get_indexes

get_list_values

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

set_value

set_vscroll_position

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

GetIndexes

GetListValues

SetFocus

SetTooltip

SetValue

Update


Menu Element

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip

Update


MenubarCustom Element

Note that while the MenubarCustom is an element, it is implemented using a function. It is actually a "compound element" that consists of several elements combined into a single Column element. See the Column element to get a list of method calls available. The function returns a Column element.


Multiline Element

bind

block_focus

expand

get

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

print

reroute_stderr_to_here

reroute_stdout_to_here

restore_stderr

restore_stdout

metadata

set_cursor

set_focus

set_size

set_tooltip

set_vscroll_position

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Get

SetFocus

SetTooltip

Update


OptionMenu Element

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

set_vscroll_position

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip

Update


Output Element

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

tk_out

set_vscroll_position

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Get

SetFocus

SetTooltip

TKOut

Update


Pane Element

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip

Update


ProgressBar Element

bind

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

update_bar

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip

Update

UpdateBar


Radio Element

bind

block_focus

expand

get

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

reset_group

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Get

ResetGroup

SetFocus

SetTooltip

Update


Sizegrip Element

bind

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

set_vscroll_position

unbind

unhide_row

update

visible


Slider Element

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip

Update


Spin Element

bind

block_focus

expand

get

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Get

SetFocus

SetTooltip

Update


StatusBar Element

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip

Update


Tab Element

add_row

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

layout

select

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

AddRow

Layout

Select

SetFocus

SetTooltip

Update


TabGroup Element

bind

block_focus

expand

find_key_from_tab_name

get

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

set_vscroll_position

unbind

unhide_row

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

FindKeyFromTabName

Get

SetFocus

SetTooltip


Table Element

bind

block_focus

expand

get

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Get

SetFocus

SetTooltip

Update


Text Element

bind

expand

get

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Get

SetFocus

SetTooltip

Update


Titlebar Element

Note that while the Titlebar is an element, it is implemented using a function. It is actually a "compound element" that consists of several elements combined into a single Column element. See the Column element to get a list of method calls available. The function returns a Column element.


Tree Element

add_treeview_data

bind

block_focus

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

set_vscroll_position

unbind

unhide_row

update

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip

Update


TreeData (for Tree Element)

Node

insert

Insert


VerticalSeparator Element

bind

expand

get_size

grab_anywhere_exclude

grab_anywhere_include

hide_row

metadata

set_cursor

set_focus

set_size

set_tooltip

unbind

unhide_row

visible


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

SetFocus

SetTooltip


UserSettings (Class interface to User Settings APIs... can also use the function call interface)

delete_entry

delete_file

exists

get

get_dict

get_filename

load

read

save

set

set_default_value

set_location

write_new_dictionary


Window

add_row

add_rows

alpha_channel

bind

bring_to_front

close

current_location

ding

disable

disable_debugger

disappear

elem

element

element_list

enable

enable_debugger

extend_layout

fill

finalize

find

find_element

find_element_with_focus

force_focus

get_screen_dimensions

get_screen_size

grab_any_where_off

grab_any_where_on

hide

key_dict

layout

load_from_disk

make_modal

maximize

metadata

minimize

move

normal

read

reappear

refresh

save_to_disk

send_to_back

set_alpha

set_cursor

set_icon

set_min_size

set_title

set_transparent_color

size

un_hide

visibility_changed

was_closed

write_event_value


These are non-PEP8 Compliant Methods - do NOT use

Do not use these... they are here for your reference should you see them in old code.

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

AddRow

AddRows

AlphaChannel

BringToFront

Close

CurrentLocation

Disable

DisableDebugger

Disappear

Elem

Element

Enable

EnableDebugger

Fill

Finalize

Find

FindElement

FindElementWithFocus

GetScreenDimensions

GrabAnyWhereOff

GrabAnyWhereOn

Hide

Layout

LoadFromDisk

Maximize

Minimize

Move

Normal

Read

Reappear

Refresh

SaveToDisk

SendToBack

SetAlpha

SetIcon

SetTransparentColor

Size

UnHide

VisibilityChanged


SystemTray

close

hide

metadata

notify

read

show_message

un_hide

update


These are non-PEP8 Compliant Methods - do NOT use

The following methods are here for backwards compatibility reference. You will find there are PEP8 versions for each of these methods. The PEP8 versions will be all lower case and have underscores.

Close

Hide

Read

ShowMessage

UnHide

Update

Function Reference

These are the functions available for you to call

Version Info

Multi-window Interface

Button Functions No Longer Used (DO NOT USE)

Note - These are no longer recommended! They are shown here in case you run into them in some old code.

Debug Window Output

Color Printing to Multiline Element of a Window

OneLineProgressMeter

Popups PEP8 Versions

Popup Alias - Same as popup_scrolled

Popup Not PEP8 Compliant names

*** You should not use these function names! ***

These versions of the popup functions are here only for backwards compatibility. Instead use the popup functions that have snake_case rather than CamelCase.

PEP8 Function Bindings

Display Objects In a Friendly Way

These functions will return an object as a string that shows each of the object's member variables. They're nice to use if you want to print any Python object, not just PySimpleGUI ones.

The Main Program - Test Harness, Global Settings, Debug Information, Upgrade from GitHub

A convention that PySimpleGUI uses is that standalone entry points start with "main_". These calls are essentially a mini-program within the PySimpleGUI.py file.

Used to get SDK help, test the installation, get information about the versions, upgrade from GitHub.

You can call main() from your code and then access these other features such as the global settings. You can also directly call these functions.

Debugger

Themes

Platform Checks

These are simple functions you can use that return a boolean True if sys.platform matches the platform. Saves you the trouble of importing sys and then looking up the values for sys.platform.

User Settings

In addition to user settings files, there is also a global PySimpleGUI settings file.

You can directly access the global settings through the UserSettings object: pysimplegui_user_settings

Exec APIs

These API calls are used to launch subprocesses.

Clipboard APIs

Note that this clipboard uses tkinter's clipboard. There is a known limitation that your application needs to remain running until you've pasted the contents. Managed to get around this limitation so that the clipboard stays set after you exit your application, but only have it working for Windows systems.

Misc

Layout Helper Funcs

Configuration / Settings / Extensions

Non PEP8 versions

Old Themes (Look and Feel) - Replaced by theme()

You should NOT use these calls. They are here for your reference should you run into them in existing code.


This documentation is copyright 2021 by PySimpleGUI Inc

Republishing the copyrighted PySimpleGUI documentation and selling it are not allowed.

When in doubt, ask.