Javatpoint Logo
Javatpoint Logo

Rank-Based Percentile GUI Calculator using PyQt5 in Python

In this post, we will get to know about how we can build a Rank based Percentile GUI Calculator with the use of the PyQt5 library in Python language.

Steps for implementing a GUI :

  1. Make a heading label with the name of the calculator.
  2. Create a label and line edit pair for the total number of students, with the label indicating what the user must input and the line edit allowing text entry.
  3. Create a pair similarly for rank.
  4. Construct a button that will compute the percentage.
  5. Create a label to display the determined percentile.

Back-end implementation procedures :

  1. Change the line edit to only take numbers as input;
  2. Add a push button action.
  3. Within the push button action, retrieve the line edits' text.
  4. Determine if the line edit text is empty or zero, and then return to prevent continued execution of the procedure.
  5. Change the value of the text to an integer.
  6. Determine the percentile and adjust the label's value accordingly.

Walking through the Code :

First of all, we will import all the modules into our program from the python standard library, these modules include QtWidgets, QtCore, QtGui and sys.

Then we created a class to set the basic properties of the window to be created.

Next, we defined the UIcomponents and created a few labels and set their properties. Along with that, we also set the colour effects and fonts too wherever required by the labels and the text fields.

Next, we created a push button for getting the results. Then, we added the function enabler to it, which performs a particular function on being clicked. After that, we created a new label to show the final result in the form of text in this field.

Finally, we created an instance of the of the main window and then we executed the code to start the application created.

Complete Code :

Output:

The output of the following Rank Based Percentile Calculator using Pyqt5 in Python has been attached below in the form of a screenshot.

Rank-Based Percentile GUI Calculator using PyQt5 in Python





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA