The simplest declarative API for quick forms and internal tools.
PySimpleGUI wraps existing GUI toolkits (primarily tkinter, optionally Qt
and wxPython) behind an extremely simple, declarative API. Instead of learning widget classes
and geometry managers, you describe your window as a nested list โ rows of
elements โ and read events in a single while True loop. It is designed to get
a working form on screen in minutes, not hours.
PySimpleGUI is popular in education, automation scripts, and quick internal tools where development speed matters more than visual polish or architectural purity.
[[Text, Input], [Button]].sg.Window(title, layout) creates the GUI.event, values = window.read() blocks until the user acts.key="-NAME-") to read input values from the values dict.sg.theme("DarkBlue3") switches color schemes instantly.import PySimpleGUIQt as sg.| Element | Purpose |
|---|---|
Text | Labels and headings |
Input / Multiline | Text fields |
Button | Actions |
Checkbox / Radio | Boolean / exclusive choice |
Combo / Listbox | Selections |
Table | Data grids |
ProgressBar | Progress indication |
pip install PySimpleGUI
pip install PySimpleGUIQt # optional Qt backend
# Verify licensing terms before commercial use.
import PySimpleGUI as sg
layout = [[sg.Text("Name:"), sg.Input(key="-N-")],
[sg.Button("OK"), sg.Button("Exit")]]
window = sg.Window("Demo", layout)
while True:
event, values = window.read()
if event in (sg.WIN_CLOSED, "Exit"):
break
if event == "OK":
sg.popup("Hello", values["-N-"])
window.close()
import PySimpleGUI as sg
sg.theme("DarkGrey13")
layout = [
[sg.Checkbox("Enable logging", key="-LOG-", default=True)],
[sg.Text("Volume"), sg.Slider((0, 100), orientation="h", key="-VOL-")],
[sg.Button("Save"), sg.Button("Cancel")],
]
win = sg.Window("Settings", layout, modal=True)
event, vals = win.read(); win.close()
layout = [
[sg.Input(key="-FILE-"), sg.FileBrowse()],
[sg.Button("Process"), sg.Button("Exit")],
]
win = sg.Window("File tool", layout)
while True:
ev, vals = win.read()
if ev in (sg.WIN_CLOSED, "Exit"): break
if ev == "Process": sg.popup("Selected:", vals["-FILE-"])
win.close()
key= strings โ they are how you read values back.sg.popup(), sg.popup_get_file() cover most dialog needs.window.perform_long_operation() to avoid freezing.Useful guides and tools (from webpage_links.xlsx).