Student Marks details using Tkinter in Python

Python - Create a Simple mark sheet using GUI(Tkinter)

  • Tkinter is Python’s standard GUI package.
  •  When combined python with Tkinter provides a fast and easy way to create GUI applications.
  • Tkinter provides a powerful object-oriented interface to the Tk GUI toolkit.
  • For examle, Get the Student details from the user and generate automatic values for total and average using Python Tkinter(GUI).
  • Generate automatic values for total and average using Python Tkinter(GUI). 

 Example program:

  1. import tkinter as tk
    master = tk.Tk()
    # display lables
    tk.Label(master, text="Name").grid(row=0, column=0)
    tk.Label(master, text="Reg.No").grid(row=0, column=3)
    tk.Label(master, text="Roll.No").grid(row=1, column=0)
    tk.Label(master, text="Srl.No").grid(row=2, column=0)
    tk.Label(master, text="1").grid(row=3, column=0)
    tk.Label(master, text="2").grid(row=4, column=0)
    tk.Label(master, text="3").grid(row=5, column=0)
    tk.Label(master, text="4").grid(row=6, column=0)
    tk.Label(master, text="5").grid(row=7, column=0)
    tk.Label(master, text="Subject").grid(row=2, column=1)
    tk.Label(master, text="Tamil").grid(row=3, column=1)
    tk.Label(master, text="Englih").grid(row=4, column=1)
    tk.Label(master, text="Maths").grid(row=5, column=1)
    tk.Label(master, text="Science").grid(row=6, column=1)
    tk.Label(master, text="Social").grid(row=7, column=1)
    tk.Label(master, text="Marks").grid(row=2, column=2)
    tk.Label(master, text="Total").grid(row=7, column=3)
    tk.Label(master, text="Average").grid(row=8, column=3)
    # Display entry fields
    e1 = tk.Entry(master)
    e2 = tk.Entry(master)
    e3 = tk.Entry(master)
    e4 = tk.Entry(master)
    e5 = tk.Entry(master)
    e6 = tk.Entry(master)
    e7 = tk.Entry(master)
    e8 = tk.Entry(master)
    e1.grid(row=0, column=1)
    e2.grid(row=0, column=4)
    e3.grid(row=1, column=1)
    e4.grid(row=3, column=2)
    e5.grid(row=4, column=2)
    e6.grid(row=5, column=2)
    e7.grid(row=6, column=2)
    e8.grid(row=7, column=2)
    def display():
                # to display total
                tk.Label(master, text=str(tot)).grid(row=7, column=4)
                # to display AVG
                tk.Label(master, text=str(avg)).grid(row=8, column=4)       
    # end of display function
    # button to display all the calculated total scores and avg
    button1=tk.Button(master, text="Submit", bg="green", command=display)
    button1.grid(row=8, column=1)


No comments:

Post a Comment

Recent Posts

Service Support

Need our help to Learn or Post New Concepts Contact me