Simple Registration Form in PyQt5 – Technoinc

Simple Registration Form in PyQt5 – Technoinc

In the previous blog, we see how to install PyQt5 and QtDesigner and getting started with it.

Today we are going to make a simple registration form. In which we will get our data on command prompt.

First, we start our designer and select the Main Window theme. Then I am going to use a text label for naming the label Name, Age, and City. For the entry, I am going to use Line Edit from Input Widget. You can also use Text Field. Also, I used a radio button for the Gender and checkbox button for Language.

After placing that all widget my application window looks like below. I saw you this window in preview mode so you can see it better. To see your application in preview mode just press ctrl + R as I mention in the previous blog.

You can customize this as per your requirement.

On the right side of your Designer window, you can see that there is the name of every object and its class under object Inspector.

Now we are going to bind that field and print the input data on our command prompt while going to press the Done button.

For that write below code and save it with .py extension. In this, we just get the data from call.lineEdit and print it on the window.

After placing all the widgets, I save my file as a regg name. The extension for this file is .ui as this is a GUI file.

After that, we have to convert this .ui file to the executable file. For that open command prompt and as we do in our previous blog, type below command.

Pyuic5 -x regg.ui -o regg.py

Now one .py file is saved in the folder where your .ui file is saved.

You can see the python code of our design in that .py file.

Now to run our application open command prompt and go to the location where our python file is saved. Then type below command.

python reg1.py

You can see the window below like if you make the same design as me. After inserting all the data press the Done button and you will get the output on your command prompt.

In the next blog, we are going to try to make other different form and application which would help you like your mini-project.

Leave a Reply

Your email address will not be published. Required fields are marked *