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:
