Latest version
If you find this project useful, please, do not forget to it.
Close
Close
Last released:
Graphical User Interfaces (GUI) Graphical interfaces can be made using a module such as PyQt5, PyQt4, wxPython or Tk. PyQt5 is the most popular option for creating graphical apps with Python. This PyQt5 tutorial shows how to use Python 3 and Qt to create a GUI on Windows, Mac or Linux. It even covers creating an installer for your app. What is PyQt5? PyQt is a library that lets you use the Qt GUI framework from Python. Qt itself is written in C. Mar 18, 2019 There are many graphical user interface (GUI) toolkits that you can use with the Python programming language. The big three are Tkinter, wxPython, and PyQt. Each of these toolkits will work with Windows, macOS, and Linux, with PyQt having the additional capability of working on mobile.
Pyforms is a Python framework to develop GUI applications based on pyqt
Project description
If you find this project useful, please, do not forget to it.
- In this page you will learn to build a basic GUI application in Python step by step. The aim is: Mastering most common GUI techniques (widgets layout, GUI constraints, event binding, etc.) Understanding each and every single method and parameter used here. See two different major GUI toolkit and learn their differences.
- In this step-by-step tutorial, you'll learn how to create a cross-platform graphical user interface (GUI) using Python and the wxPython toolkit. A graphical user interface is an application that has buttons, windows, and lots of other widgets that the user can use to interact with your application.
Pyforms GUI is a software layer, part of the Pyforms main library. This layer implements the execution of a Pyforms application as Windows GUI.
Pyforms is a Python 3 cross-enviroment framework that aims the boost the development productivity. The library provides an API in Python to develop applications that can be executed in Windows GUI mode, Web mode, or in Terminal mode.
Advantages
- With a minimal API, interfaces are easily defined using a short Python code.
- Avoid the constant switching between the GUI designers and the Python IDE.
- It is designed to allow the coding of advanced functionalities with a minimal effort.
- The code is organized in modules and prepared to be reused by other applications.
- It makes the applications maintenance easier.
- Turn the prototyping much easier and fast.
- Due to its simplicity it has a low learning curve.
Examples of applications developed in Pyforms GUI
Installation
Check the documentation at pyforms.readthedocs.org and pyforms-gui.readthedocs.org
Rationale behind the framework
The development of this library started with the necessity of allowing users with low programming skills to edit parameters from my python scripts.The idea was to transform scripts which had already been developed into GUI applications with a low effort and in a short time.
For example in my computer vision applications in the majority of the times there were variables that had to be set manually in the scripts for each video, to adjust the thresholds, blobs sizes, and other parameters to the environment light conditions... To test each set of parameters the script had to be executed.With GUI applications, users would be able to set the parameters using a GUI interface and visualize the results instantly without the need of restarting the script. That was the idea.
After looking into the several python options for GUI interfaces, PyQt was the one that seemed the best tool for a fast development with the QtDesigner, but after a while developing in Qt, switching between the designer and the python IDE was becoming too costly in terms of time because the interfaces were constantly evolving.
Being a Django developer, I did get inspiration on it for this framework. In the Django Models we just need to define the type of variables and their disposition in the form (in ModelAdmin) to generate a HTML form for data edition.For the GUIs that I wanted to build in my python scripts, I would like to have the same simplicity, so I could focus on the algorithms and not on GUIs developing.
The result was the simplicity you can see in the example below:
Result of runnning the application in the terminal:
Project details
Release historyRelease notifications
4.904.152
4.904.151
4.904.150
4.904.149
4.904.147
4.904
4.902
4.901.2
4.901
4.9.2
4.9
4.8
4.7
4.6
4.5
4.4
4.3
4.2
4.1
4.0.14
4.0.12
4.0.11
4.0.10
4.0.9
Linux Gui
4.0.8
4.0.7
Windows Gui Downloads
4.0.6
4.0.5
4.0.4
4.0.3
4.0.2
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size PyForms_GUI-4.904.152-py3-none-any.whl (136.4 kB) | File type Wheel | Python version py3 | Upload date | Hashes |
Filename, size PyForms GUI-4.904.152.tar.gz (95.5 kB) | File type Source | Python version None | Upload date | Hashes |
Hashes for PyForms_GUI-4.904.152-py3-none-any.whl
Algorithm | Hash digest |
---|---|
SHA256 | 2f90a9c6fe8dcd80f1997a87ed4e35324587ce086069690bf5bb15296ce6a628 |
MD5 | 73783c79ccaf3990a3079366669ca386 |
BLAKE2-256 | a55147d24434c7af3d30496f2af17132c2d8f557912dc75f745e6ec90a8521f1 |
Hashes for PyForms GUI-4.904.152.tar.gz
Algorithm | Hash digest |
---|---|
SHA256 | 3ff658219da674cfef9074111efcbfa2aa315565c2f8f9c7038672cf5f78fe0f |
MD5 | 98858bf8a4bdbb633b7e54ed45fb3429 |
BLAKE2-256 | 1f10a0f9e1e0633caf919bf2356f82239fffd55607315972f9d8564fd1bbe869 |
- Python Basic Tutorial
- Python Advanced Tutorial
- Python Useful Resources
- Selected Reading
Python provides various options for developing graphical user interfaces (GUIs). Most important are listed below.
- Tkinter − Tkinter is the Python interface to the Tk GUI toolkit shipped with Python. We would look this option in this chapter.
- wxPython − This is an open-source Python interface for wxWindows http://wxpython.org.
- JPython − JPython is a Python port for Java which gives Python scripts seamless access to Java class libraries on the local machine http://www.jython.org.
There are many other interfaces available, which you can find them on the net.
Tkinter Programming
Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to create GUI applications. Tkinter provides a powerful object-oriented interface to the Tk GUI toolkit.
Creating a GUI application using Tkinter is an easy task. All you need to do is perform the following steps −
- Import the Tkinter module.
- Create the GUI application main window.
- Add one or more of the above-mentioned widgets to the GUI application.
- Enter the main event loop to take action against each event triggered by the user.
Example
This would create a following window −
Python Windows Gui
Tkinter Widgets
Tkinter provides various controls, such as buttons, labels and text boxes used in a GUI application. These controls are commonly called widgets.
There are currently 15 types of widgets in Tkinter. We present these widgets as well as a brief description in the following table −
Sr.No. | Operator & Description |
---|---|
1 | Button The Button widget is used to display buttons in your application. |
2 | Canvas The Canvas widget is used to draw shapes, such as lines, ovals, polygons and rectangles, in your application. |
3 | Checkbutton The Checkbutton widget is used to display a number of options as checkboxes. The user can select multiple options at a time. |
4 | Entry The Entry widget is used to display a single-line text field for accepting values from a user. |
5 | Frame The Frame widget is used as a container widget to organize other widgets. |
6 | Label The Label widget is used to provide a single-line caption for other widgets. It can also contain images. |
7 | Listbox The Listbox widget is used to provide a list of options to a user. |
8 | Menubutton The Menubutton widget is used to display menus in your application. |
9 | Menu The Menu widget is used to provide various commands to a user. These commands are contained inside Menubutton. |
10 | Message The Message widget is used to display multiline text fields for accepting values from a user. |
11 | Radiobutton The Radiobutton widget is used to display a number of options as radio buttons. The user can select only one option at a time. |
12 | Scale The Scale widget is used to provide a slider widget. |
13 | Scrollbar The Scrollbar widget is used to add scrolling capability to various widgets, such as list boxes. |
14 | Text The Text widget is used to display text in multiple lines. |
15 | Toplevel The Toplevel widget is used to provide a separate window container. |
16 | Spinbox The Spinbox widget is a variant of the standard Tkinter Entry widget, which can be used to select from a fixed number of values. |
17 | PanedWindow A PanedWindow is a container widget that may contain any number of panes, arranged horizontally or vertically. |
18 | LabelFrame A labelframe is a simple container widget. Its primary purpose is to act as a spacer or container for complex window layouts. |
19 | tkMessageBox This module is used to display message boxes in your applications. |
Simple Python Gui Examples
Let us study these widgets in detail −
Standard attributes
Let us take a look at how some of their common attributes.such as sizes, colors and fonts are specified.
Let us study them briefly −
Geometry Management
All Tkinter widgets have access to specific geometry management methods, which have the purpose of organizing widgets throughout the parent widget area. Tkinter exposes the following geometry manager classes: pack, grid, and place.
- The pack() Method − This geometry manager organizes widgets in blocks before placing them in the parent widget.
- The grid() Method − This geometry manager organizes widgets in a table-like structure in the parent widget.
- The place() Method − This geometry manager organizes widgets by placing them in a specific position in the parent widget.
Let us study the geometry management methods briefly −