Open In App
Related Articles

Designing GUI applications Using PyQt in Python

Improve Article
Save Article
Like Article

Building GUI applications using the PYQT designer tool is comparatively less time-consuming than code the widgets. It is one of the fastest and easiest ways to create GUIs. 

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
 pip install pyqt5-tools 

Let’s create a signup form using the QT designer tool. No code is required for creating forms, buttons, text boxes, etc! It is a rather drag and drops environment. So, using PyQt is a lot simpler than Tkinter. 

QT Designer will be located at MyPythonInstallationDir\Lib\site-packages\pyqt5-tools and is named designer.exe (on Windows OS). 
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 the Signup form, the following widgets are needed : 

  1. Three text edit boxes.
  2. One button.
  3. 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 the window or the widget, just right click on the widget and click Change StyleSheet.  

To get a preview of the window, press Ctrl + R. 

Save the file : 
The file will be saved with the .ui extension. To convert this file (.ui extension) to a Python file (.py extension), follow these steps :  

  1. Open the terminal and navigate to the folder where the layout.UI file is present.
  2. To convert into a Python file, type pyuic5 -x layout.ui -o on a terminal.
  3. Run using python!


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 07 Sep, 2021
Like Article
Save Article
Similar Reads
Complete Tutorials