Building GUI applications using PYQT designer tool is comparatively less time consuming than code the widgets. It is one of the fastest and easiest ways to create GUI’s.
The normal approach is to write the code even for the widgets and for the functionalities as well. But using Qt-designer, one can simply drag and drop the widgets, which comes very useful while developing big-scale applications.
Installation of PyQt5 :
- For Linux :
sudo apt-get install python3-pyqt5
- For Windows :
pip install pyqt5
Let’s create a signup form using the QT designer tool. No code is required for creating forms, buttons, text boxes etc! It is rather a drag and drop environment. So, using PyQt is a lot simpler than Tkinter.
Open Qt Designer, then select Main Window and click Create. Set your preferred size of the window by dragging the edges of the window.
To create the layout of Singup form, following widgets are needed :
- Three text edit boxes.
- One button.
- Four Text Labels (SignId Banner, UserName label, Password and Confirm Password label).
One has to find those widgets in Widget Tool Box. Just drag and drop the required widgets onto the Main Window or the window working on.
To change the appearance of window or the widget, just right click on the widget and click Change StyleSheet.
To get preview of the window, press
Ctrl + R .
Save the file :
The file will be saved with
.ui extension. To convert this file (
.ui extension) to Python file (
.py extension), follow these steps :
- Open terminal and navigate to the folder where the
layout.uifile is present.
- To convert into Python file, type
pyuic5 -x layout.ui -o layout.pyon terminal.
- Python String index() and its applications
- Python Language advantages and applications
- isupper(), islower(), lower(), upper() in Python and their applications
- Important differences between Python 2.x and Python 3.x with examples
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Sort Python Dictionaries by Key or Value
- bin() in Python
- max() and min() in Python
- chr() in Python
- abs() in Python
- gcd() in Python
- pow() in Python
- try and except in Python
- SQL using Python | Set 1
- Any & All in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.