Quick and easy with PySimpleGUI

Simple Is Good

© Lead Image © Andrey Burmakin, 123RF.com

© Lead Image © Andrey Burmakin, 123RF.com

Article from Issue 241/2020

Use the same code for your Python GUI and web apps.

The PySimpleGUI project has two main goals: a simpler method for creating graphical user interfaces (GUIs), and common code for Tkinter, QT, Wx, and web graphics. Although I feel comfortable doing my own Python Tkinter and web interfaces, having common code for both local GUI and web apps could be extremely useful, especially for Raspberry Pi projects. In this article, I introduce PySimpleGUI and create both a local GUI and a web interface to control a Raspberry Pi rover, all in less than 60 lines of code.

Getting Started

The Python PySimpleGUI [1] project has a number of "ports" or versions. The main full-featured version is for Tkinter-based graphics. The versions for Qt, Wx, and web graphics are still in development, so some testing will be required if you are hoping for full code compatibility between the different libraries.

Although you probably won't encounter a lot of cases in which you would want to flip between Qt, Wx, and Tkinter graphic engines, the possibility exists. Figure 1 shows examples of the same code applied to the different graphic libraries.


Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Python’s Tkinter Library

    Use Tkinter to control your Rasp Pi projects from a smartphone or tablet.

  • Tutorials – TkInter

    Expand your Python knowledge and write GUI apps with a smattering of code, thanks to the TkInter toolkit.

  • Function Generator HAT

    A touch display, a case, and a custom add-on board transform the humble Rasp Pi into a high-performance function generator that rivals expensive commercial offerings.

  • Practical Python in Linux

    We’ll introduce you to Python, an easy-to-learn scripting language, and also help you get started creating your own practical Python scripts.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95