|Initial release||11 July 2018|
|License||GNU Lesser General Public License (LGPLV3+)|
Search PySimpleGUI on Amazon.
PySimpleGUI is a wrapper to the Tkinter Python API that allows the programmer to utilize all the same UI elements as with Tkinter but with a more intuitive interface. PySimpleGUI was established in an effort to create a more user-friendly Python GUI development process. PySimpleGUI combines the most effective elements of packages like EasyGUI and WxSimpleGUI, and adds the ability to define custom layouts.
PySimpleGUI is OSI approved under the GNU LESSER GENERAL PUBLIC LICENSE V3 OR LATER (LGPLV3+).
Launched in July, 2018, PySimpleGUI sought a solution to streamline the Python GUI development efforts and move users from the command line to a windowed / GUI experience. The PySimpleGUI package is focused on the developer, allowing them to create a custom GUI with as concise code as possible.
The PySimpleGUI functions can be split into “High Level” calls that enable the caller to perform input/output operations in a single function call, and “Custom GUI” capabilities. The high-level calls usually start with “Popup”. The most basic of these is Popup which displays a variable number of items in a pop-up window. They resemble the built-in “print” statement, taking any number of variables in any format and displaying them in a window. The Popup calls that gather user input include PopupGetText, PopupGetFile and PopupGetFolder. Custom GUIs are achieved by first creating a “GUI layout” that is used to create and display a Window. The GUI layout is composed of “Elements”, PySimpleGUI’s term for a GUI “Widget”.
Simplifying and compacting the code can be achieved by leveraging two of PySimpleGUI’s “shortcuts”. Element names can be written in a short-form format. It reduces the amount of text in the code without losing meaning.
A second shortcut mechanism is pre-defined buttons. These are buttons commonly found in all GUIs such as “ok”, “cancel”, “yes”. Rather than writing Button(‘ok’) a button shortcut allows writing Ok(*), Cancel(), Yes().
|UI elements||Button-Shortcuts||Element abbreviations|
|T = Text
Txt = Text
In = InputText
Input = IntputText
Combo = InputCombo
DropDown = InputCombo
Drop = InputCombo
The "High Level" API calls that output values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. For full list of features and how to implement them please refer to the PySimpleGUI CookBook.
PySimpleGUI's goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what is on the screen.
Some examples of how this package attempts to use language constructs in a natural way and exploit some of Python's interesting features:
- Forms are represented as Python lists.
- A form is a list of rows
- A row is a list of elements
- Return values are a list of button presses and input values.
- Return values can also be represented as a dictionary
- The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values
In addition to a Python-like API, the PYSimpleGUI documentation provides a number of example code snippets allowing developers in need to get up and running by copying, pasting, and sometimes modifying the code to create the desired GUI without needing to learn the library prior to use.
PySimpleGUI focuses on the creation of Python native UI in as simple code as possible. When creating UI with PySimpleGUI every call has optional parameters so that you can change the look and feel. Changing a button color can be done by adding a button_color parameter to your widget. The configure is done in-place.
With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line.
import PySimpleGUI as sg
layout = [[sg.Text('Hello World!')],
window = sg.Window('Wikipedia Window').Layout(layout)
event, data = window.Read()
Getting Started with PySimpleGUI
For the latest news, configuring and getting started with PySimpleGUI you can refer to the GitHub project.
For a deeper look into the use of PySimpleGUI you can refer to the PySimpleGUI cookbook.
For a lower level look under the hood of PySimpleGUI refer to this explanation by the developer.
- Python 2.7 tkinter
- Python 3 tkinter
- Kivy (coming soon)
- WxPython (coming soon)
- RasberryPi (For examples running on a RasberryPi please refer to entries found on the Rasberrypi forums.)
- "PySimpleGui". libraries.io. Retrieved 2018-09-07.
- "PySimpleGUI". PyPI. Retrieved 2018-09-07.
- "Add GUIs to your programs and scripts easily with PySimpleGUI". Opensource.com. Retrieved 2018-09-07.
- "A simple yet powerful GUI built on top of tkinter". Python Awesome. 2018-07-19. Retrieved 2018-09-08.
- "PySimpleGui under the hood".
- "PySimpleGUI - New package for building custom GUIs in a few lines of code - Page 2 - Raspberry Pi Forums". www.raspberrypi.org. Retrieved 2018-09-08.
This article "PySimpleGUI" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:PySimpleGUI. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.