{"id":24397,"library":"PySimpleGUI","title":"PySimpleGUI","description":"PySimpleGUI is a Python package that enables creating simple, cross-platform GUIs with ease. It wraps tkinter, Qt, WxPython, and Remi (web) into a unified API. Current version is 6.0, released in 2026 under LGPL3. New major version with significant API changes and improved theming.","status":"active","version":"6.0","language":"python","source_language":"en","source_url":"https://github.com/PySimpleGUI/PySimpleGUI","tags":["gui","tkinter","cross-platform","desktop"],"install":[{"cmd":"pip install PySimpleGUI","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"Common mistake: wildcard imports can pollute namespace and hide errors. Always use 'import PySimpleGUI as sg'.","wrong":"from PySimpleGUI import *","symbol":"PySimpleGUI","correct":"import PySimpleGUI as sg"},{"note":"Recommended pattern is to use sg prefix; direct imports may cause confusion with other libraries.","wrong":"from PySimpleGUI import Window; Window(...)","symbol":"sg.Window","correct":"import PySimpleGUI as sg; sg.Window(...)"}],"quickstart":{"code":"import PySimpleGUI as sg\n\nlayout = [[sg.Text('Hello from PySimpleGUI')],\n          [sg.Button('OK')]]\n\nwindow = sg.Window('Demo', layout)\n\nwhile True:\n    event, values = window.read()\n    if event == sg.WIN_CLOSED or event == 'OK':\n        break\n\nwindow.close()","lang":"python","description":"Creates a simple window with a text and a button. Uses the standard event loop pattern."},"warnings":[{"fix":"Update theme calls to new API: use sg.theme('DarkBlue3') instead of sg.SetOptions(background_color='...'). Check release notes for full list of changes.","message":"Version 6.0 introduced a completely new theming system and deprecated many old theme names. If upgrading from 5.x, existing themes may break.","severity":"breaking","affected_versions":"5.x -> 6.0"},{"fix":"In event loop, explicitly break when event is 'OK' or sg.WIN_CLOSED.","message":"The 'Button' element is now 'Button' (capital B) instead of 'Button' in older versions? Actually, it's always been Button. But in 6.0, the 'OK' button no longer auto-closes the window; you must handle the event explicitly.","severity":"breaking","affected_versions":"6.0"},{"fix":"Always call window.close() after the event loop ends. Use try/finally or context manager if available (not in standard API).","message":"Calling window.close() outside the event loop or forgetting to close the window can cause memory leaks or hanging processes.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure you installed PySimpleGUI with correct casing: pip install PySimpleGUI (case-sensitive on some systems). Then use import PySimpleGUI as sg.","cause":"Typo or incorrect import. Common mistake: installing 'pysimplegui' (lowercase) instead of 'PySimpleGUI' (capital letters).","error":"AttributeError: module 'PySimpleGUI' has no attribute 'Window'"},{"fix":"Add 'import PySimpleGUI as sg' at the top of your script.","cause":"Forgot to import or used wrong import alias.","error":"NameError: name 'sg' is not defined"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}