Building PyQt Graphical User Interface
Follow steps described below to create design of future GUI, convert it from .ui to .py file
and run application.
Step 1: Create design of GUI in Qt Designer
To run Qt Designer open Terminal (or Anaconda Prompt), activate your environment where
you have installed Qt Designer and use following command:
• designer
As a result, the main window of Qt Designer will be opened.
• Drag and drop Label and PushButton from Widget Box
• Add Lay Out Vertically to make elements follow main window when it is resized
• Make adjustments of maximum size for elements and main window in Property Editor
• Save created GUI and name it, for instance, [Link]
Section-7
Building PyQt GUI
Step 2: Convert .ui into .py
To convert .ui file into .py file open Terminal (or Anaconda Prompt), activate your
environment where you have installed PyQt, then navigate to saved file [Link] and run
following command:
• pyuic5 [Link] -o [Link]
As a result, new file [Link] will appear next to [Link] file.
Step 3: Run Application
Copy converted file [Link] into folder GUI that includes downloaded file [Link] and image.
• Run file [Link]
• Click on button and find image
• Click open
As a result, image will appear in the GUI window.
Page 2