×

Rank Based Percentile GUI Calculator using Tkinter in Python

GUI:

The user is provided with information using manipulable visual widgets that don't require command-line input. These interface components respond to the user's interactions per the pre-programmed script, assisting each user's action. Since many GUIs represent text and graphical elements in standard formats, it is possible for programs using the same GUI software to share data. As it is patched and developed, the same software application or os version may present distinct or marginally distinct GUIs. The appearance of an application may change depending on user needs or to enhance the user experience, even if the application's core functionality and functions remain unchanged, as was the case with the various Windows versions over time.

A graphical interface (GUI) is a user interface that lets users interact with electronic devices like computers and smartphones by using menus, icons, and other visual cues (graphics). In contrast to text-based interfaces, which only display data and commands as text, GUIs visualize information and related user controls. A cursor, trackball, stylus, or thumb on a touch screen are all pointing devices that can be used to communicate with GUI representations. The first text interface between a human and a computer operated using keyboard input and a prompt.

Commands were entered at the DOS prompt to ask for responses from a desktop. These commands' usage and the requirement for precise spelling led to an unwieldy and ineffective user interface.

Advantages of GUI:

Quick and easy access to any screen area allows for full-screen interaction. You merely click a button or an icon to invoke the necessary function. The general public now has access to a wide range of systems for daily use, regardless of experience or knowledge, thanks to the simplicity of GUIs. Additionally, Tkinter provides access to the widgets' geometric configuration, which can arrange the widgets in the parent windows.

Tkinter:

The standard Python technique for building Graphical User Interfaces (GUIs) is Tkinter, which is included in all popular Python distributions. The only framework included in the Python standard library is this one. On top of Tk, this Python framework serves as a thin object-oriented layer that provides access to the Tk toolkit. The Tk toolkit is a cross-platform set of "graphical control elements," also called widgets, used to build application interfaces. This framework gives Python users a quick and easy way to build GUI elements with the Tk toolkit's widgets. In a Python application, Tk widgets can be used to create buttons, menus, data fields, etc.

Once created, these graphic elements can be connected to or work with other widgets, features, functionality, processes, or data.

Tkinter bridges the gap between Python's execution model and Tcl's, built around cooperative multitasking. Like Python, Tcl is an interpreted dynamic programming language. Although it is an overall programming language that can be used independently, it is most frequently used in C programs as a scripting motor or as an interaction with the Tk toolbox.

Syntax:

from tkinter import *
from tkinter import ttk

CODE:

from tkinter import *
 
def getPercentile() :
  
    students= int(total_participantField.get())
      
    rank = int(rankField.get())
  
    result = round((students - rank) / students * 100,3);
  
    percentileField.insert(10, str(result))
    
def Clear():
      
    # deleting the content from the entry box
    rankField.delete(0, END)
      
    total_participantField.delete(0, END)
      
    percentileField.delete(0, END)
      
  
# Driver Code
if __name__ == "__main__" :
  
    gui = Tk()
    
    gui.configure(background = "light green")
    
    gui.title("Rank Based- Percentile Calculator")
    
    gui.geometry("650x200")
  
    rank = Label(gui, text = "Rank", bg = "blue")
  
    andl = Label(gui, text = "And", bg = "blue")
    
    total_participant = Label(gui,
                              text = "Total Participants",
                              bg = "blue")
  
    find = Button(gui, text = "Find Percentile",
                  fg = "Black", bg = "Red",
                  command = getPercentile)
      
    percentile = Label(gui, text = "Percentile", bg = "blue")
  
    clear = Button(gui, text = "Clear",
                   fg = "Black", bg = "Red",
                   command = Clear)
  
    rank.grid(row = 1, column = 1,pads = 10)
  
    andl.grid(row = 1, column = 4)
                   
    total_participant.grid(row = 1, column = 6, padx = 10)
  
    find.grid(row = 3, column = 4,pady = 10)
      
    percentile.grid(row = 4, column = 3,padx = 10)
      
    clear.grid(row = 5, column = 4,pady = 10)
  
    rankField = Entry(gui)
      
    total_participantField = Entry(gui)
    percentileField = Entry(gui)
  
    rankField.grid(row = 1, column = 2)
      
    total_participantField.grid(row = 1, column = 7)
      
    percentileField.grid(row = 4, column = 4)
      
    gui.main loop()

OUTPUT:

Rank Based Percentile GUI Calculator using Tkinter in Python

Related Topics

GUI to Shut down, Restart and Logout from the PC using Tkinter in Python

GUI: One of the most significant factors that increased the usability of computer and digital technologies for common, less tech-savvy users is likely the development and widespread adoption of GUIs. GUIs...

4 minutes read.

Python Scikit-image | Image Processing Using Scikit-Image

What is Image Processing? The world is defined with images and, every image has its different specialties. An image can contain much-needed information that can be helpful in various ways. The process...

4 minutes read.

How to run a Python file in CMD

Introduction Today, let us learn about how to run a Python file using cmd. Cmd is nothing but command prompt. So first let us know how to run a Python code...

4 minutes read.

Parameter Passing in Python

In Python, when we characterize capabilities with default values for specific boundaries, it is said to have its contentions set as a possibility for the client. Clients can either pass their...

3 minutes read.

How to make a firewall in Python?

Firewall: The firewall is a network which controls the incoming and outgoing network traffics of a monitor. It blocks the dataset based on the set of rules written in the security...

3 minutes read.

Looping through Data Frame in Python

Iterate over Rows and Columns in Pandas Dataframe This tutorial aims to make us understand what Pandas in Python are, what Data Frame in Python is and its significance, what are...

4 minutes read.

Python Encapsulation

What is meant by Encapsulation? The process of restricting access to the methods and variables so that accidental modification of data can be prevented is known as Encapsulation. The motive of Encapsulation:...

3 minutes read.

Python type() Function

Python type() Function The type() function in Python returns the type of an object. The return value is a type object and generally the same object as returned by object.__class__. Syntax class type(object)      ...

1 minute read.

tell() function in Python

Introduction The tell() function in Python is used to return the current position of the file read/write pointer within the file. An integer value is returned by this method, and it...

2 minutes read.

How to get current date in python?

How to get current date in python? In Python programming language, date and time are not just a data form, but it is possible to import a method called datetime to operate...

3 minutes read.

Subprocess Module in Python

What is a Process? Every program will have its respective system state, i.e., the state in which it is running. A program that is in a running state or in a...

7 minutes read.

Python Dictionary keys() method

Python Dictionary keys() method The dictionary.keys() method in Python returns a view object that displays a list of all the keys in the dictionary Syntax dictionary.keys() Parameter NA Return This method returns a view object that displays...

2 minutes read.

Python vs HTML

Python and HTML are not comparable since they are two separate categories of programming languages. Building the structures and layouts of a web page or app requires the usage of HTML,...

8 minutes read.

How to Add Elements in List in Python?

How to Add Elements in List in Python We all are aware of the wide spectrum of applications where the data structures of Python are used. Be it lists, tuples, or...

4 minutes read.

Import py file in Python

In Python programming language, a module is a single layer of block of Python code that can be loaded and used by importing into other Python block of code. A module...

4 minutes read.

Screen Rotation app Using Tkinter in Python

Tkinter: The standard Python technique for building Graphical User Interfaces (GUIs) is Tkinter, which is included in all popular Python distributions. The only framework included in the Python standard library is...

3 minutes read.

Python Bubble Sort

Bubble sort is one of the techniques used to sort the elements in lists in a certain order, either in ascending or descending order. It is called Bubble sort because...

4 minutes read.

How to Iterate a List in Python

As we know, a List is one of the four unique data structures available in Python; in this article, we will deep dive into understanding iterating through a list and...

3 minutes read.

Curdir Python

Python Programming Language Python is an interactive and more accessible language than any other programming language. The python programming language uses a variety of libraries to perform the operations in a...

3 minutes read.

Python program to count and display vowels in a string

Python program to count and display vowels in a string This python program counts the vowels in a string and displays them on the screen. We can do this in several...

2 minutes read.