PACK 2025
, Chapter 7 – Converting Data types
Add two numbers application
Step 1 Open Qt Designer
Open the QtDesigner by selecting the Qt Designer program icon
Step 2: Selecting a Template
Click on the “Dialog without Buttons” option.
Click the Create button.
A new form with the caption “untitled” will be created without any widgets.
Step 3: Adding Widgets
, Add the following widgets and configure their properties. Note: Python is case-sensitive, so ensure the correct letter
casing for all object names.
Widget Details
QLabel (Display Widgets Section)
Properties:
objectName: labelFirstNumber
text: Enter First Number
QLabel (Display Widgets Section)
Properties:
objectName: labelSecondNumber
text: Enter Second Number
QLabel (Display Widgets Section)
Properties:
objectName: labelAddition
QLineEdit (Input Widgets Section)
Properties:
objectName: lineFirstNumber
QLineEdit (Input Widgets Section)
Properties:
objectName: lineSecondNumber
QPushButton (Buttons Section)
Properties:
objectName: AddButton
text: Add
Previewing the Form
Press Ctrl+R to preview the form.
The form should resemble the layout below:
, Note:
This guide was originally created by MJ Kies (2017) for use with the book “Introduction to Python Programming and
Developing GUI Applications with PyQT”.