Python GUI Tutorials: GUI & Program Examples
Python GUI Tutorial
GUI stands for Graphical User Interface and it can make a piece of code more user friendly and visual. Thanks to GUI, we can use complicated command line programs in a much more practical way.
For billions of people GUI means convenience and accessibility as it makes it possible for majority of the world population to use software. As a software developer, entrepreneur, coder or businessman you might also want to have GUI skills to transform your computer programs to end-user products and services.
I’m going to explain how you can quickly learn and start building GUI programs with Python in this tutorial. Also, GUI can be used for personal use when you are automating a repetitive task or to create exe files and run code in taskbar or startup with event scheduler.
What is GUI?
GUI is the visual interface of computer programs. Contrary to the command line or console, GUI usually has visual components such as buttons, checkboxes, radio buttons, input forms, adjustment wheels etc. for users to interact with.
GUI doesn’t exist as a standalone program, it is still tied to some code in the back end that’s triggered when buttons are clicked or inputs are entered.
It can be said that GUI compliments source code or back end code.
GUI history is not as old as computation itself. Its first development dates back to 1981 when Xerox engineers and researchers invented it at PARC (Palo Alto Research Center). Then Apple’s adaptation of GUI technology comes in January 1983 and the rest is history.
If you’re like the average modern user, you interact with 100+ different GUI applications per day.
- apps on your phone
- operating systems’ gui, even Linux has one
- smart tv home screen and each app
- native windows apps like Notepad, Paint, Calculator
- if you’re lucky to have a high-end car like Tesla, the apps on your dashboard
- all the software you might be using for work and business
- even the IDE or Notepad you are coding in has a GUI for convenience.
Python PySimpleGUI Tutorials
PySimpleGui is a very practical and easy to learn Python GUI library.
PySimpleGui works with most of the other Python GUI libraries under the hood (such as tkinter, Qt, Remi, WxPython) but it offers a very friendly and Pythonic way to create GUIs based on those libraries.
How to Install PySimpleGui
pip install pysimplegui or pip3 install pysimplegui
PySimpleGUI has a very active Github repository with lots of contributions. You can see tens of GUI examples, software and libraries people have created. If you need some inspiration you can check out the Issue #10 where people share screenshots of their GUI programs.
Also, you can find some information on GUI history on ComputerHope website’s page.
Here are also a couple of videos about PySimpleGui. First one is the first video of a really nice tutorial series and the second one is how to make a calculator with PySimpleGUI.
Python Library Packaging
On top of that, GUIs can get you interested in publishing a library of your own. This takes a useful code that you’ve created and packaging that code as a Python library before shipping it to PyPI.
Here are some tutorials we have created that will answer nearly all of the Python Packaging needs for most people.
Python Packaging Tutorials
Event Scheduler Python Code
You can also tap into the event scheduling opportunities. Although you don’t necessarily need GUI to schedule your program it can still be more convenient that way especially if you decide to create an exe file with GUI programming.
We’ve explained how to create GUI programs using Python’s PySimpleGui library in this Python Tutorial. We have also seen how to create GUI checkboxes and radio buttons, how to adjust sizes and margins of GUI objects, how to create file and folder browsers and input forms.
In the last half of the tutorial we have provided information about how to package libraries for Python and how to upload Python libraries to PyPI. We also had an Python library example which have been created from scratch with a GUI and packaged and uploaded to PyPI.