0% found this document useful (0 votes)
3 views11 pages

Gui Final AYU

The document outlines a project on designing a GUI-based Python application for student information using Tkinter. It details the objectives, tools used, source code, output screenshots, and conclusions drawn from the activity. The project aims to enhance practical coding skills and understanding of GUI development in Python.

Uploaded by

SHIVAM SINGH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views11 pages

Gui Final AYU

The document outlines a project on designing a GUI-based Python application for student information using Tkinter. It details the objectives, tools used, source code, output screenshots, and conclusions drawn from the activity. The project aims to enhance practical coding skills and understanding of GUI development in Python.

Uploaded by

SHIVAM SINGH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

INTRODUCTION TO PYTHON PROGRAMMING

[PLC425B]
“Designing a GUI-based Python Application for Student
Information”
16-06-2025

SUBMITTED BY:
AYUSH THAKUR - 4MC24CS026
Computer Science and Engineering

For the award of degree


Bachelor of Engineering in Computer Science

Under the guidance of


Dr. Prakruthi H L
Associate Professor

Department of Electronics and Communication Engineering

Malnad College of Engineering


(An Autonomous Institution under Visvesvaraya Technological University, Belagavi)
#21 Hassan -573202 , Karnataka ,India
2025
CONTENTS:

CONTENTS PAGE NUMBER

Objective 1

Tools Used 2

Source Code 3-6

Output Screenshots 7

Conclusion 8
Designing a GUI-based Python Application for Student Information

OBJECTIVES OF THE ACTIVITY :


Objective
The main goal of this activity is to:

 Design and develop a Python GUI application using the Tkinter library.

 Create a simple user interface for entering student information such as:
o First Name
o Last Name
o Department
o Gender (Male / Female / Others)

 Implement functionality for:


o Login Button – to display all entered information in a message box.
o Cancel Button – to close the application.

This helps in understanding GUI development using Python and enhances practical coding
skills.

1
Designing a GUI-based Python Application for Student Information

Tools Used :
 Programming Language
 Python 3.10

Python is a high-level, easy-to-read programming language known for its simplicity


and wide range of applications. It supports multiple programming paradigms and is
widely used in web development, data science, AI, and automation.

 GUI Library
 Tkinter :

Tkinter is the built-in GUI (Graphical User Interface) toolkit that comes with Python.
It acts as a wrapper around the Tcl/Tk GUI toolkit and allows developers to create
desktop applications with windows, menus, buttons, forms, and more. Tkinter is easy
to learn and is especially useful for building small to medium-sized applications.

Key Features of Tkinter :


 Widgets: Includes standard GUI elements like Button, Label, Entry, Text, Frame,
Canvas, Menu, and more.
 Geometry Managers: Provides layout management tools like pack(), grid(), and
place() to arrange widgets.

 IDE (Code Editor)


 Visual Studio Code (VS Code)
Feature-rich and widely used editor for Python development
 Operating System
 Windows 11

2
Designing a GUI-based Python Application for Student Information

SOURCE CODE OVERVIEW :


 Key Features of the Code:
 Used Tkinter to create GUI components.

 Collected user input via:


o Entry Widgets for First Name, Last Name, Department.
o Radio Buttons for Gender selection.

 Two functional buttons:


o Submit: Displays user input in a message box.
o Cancel: Closes the application

SOURCE CODE:
import tkinter as tk
from tkinter import messagebox

# Function to submit info def


submit_info():
first = entry_fname.get()
last = entry_lname.get()
dept = entry_dept.get()
gender = gender_var.get()

# Validation
if not all([first, last, dept, gender]):

3
Designing a GUI-based Python Application for Student Information

messagebox.showwarning("Incomplete Data", "Please fill all


the fields.")
return

# Save to file
with open("students.txt", "a") as f:
f.write(f"{first} {last}, Dept: {dept}, Gender: {gender}\n")

# Show in new window


new_window = tk.Toplevel(root)
new_window.title("Student Info
Submitted")
new_window.geometry("300x200")
new_window.config(bg="#fff3e0")

tk.Label(new_window, text="✅ Info Submitted!", font=("Arial",


12, "bold"), bg="#fff3e0", fg="green").pack(pady=10)
tk.Label(new_window, text=f"Name: {first} {last}",
bg="#fff3e0").pack()
tk.Label(new_window, text=f"Department:
{dept}", bg="#fff3e0").pack()
tk.Label(new_window, text=f"Gender: {gender}",
bg="#fff3e0").pack()

# Function to close app


def close_app():
4
Designing a GUI-based Python Application for Student Information

root.destroy()

# GUI Window Setup


root = tk.Tk()
root.title("🎓 Student Registration Form")
root.geometry("450x330")
root.config(bg="#e3f2fd")

# Labels & Inputs using .place()

tk.Label(root, text="Student Registration 📝", font=("Comic Sans


MS", 16, "bold"), bg="#e3f2fd", fg="#0d47a1").place(x=80,
y=20)

tk.Label(root, text="First Name:", bg="#e3f2fd").place(x=30,


y=80)
entry_fname = tk.Entry(root, width=30)
entry_fname.place(x=150, y=80)

tk.Label(root, text="Last Name:", bg="#e3f2fd").place(x=30,


y=110)
entry_lname = tk.Entry(root, width=30)
entry_lname.place(x=150, y=110)

5
Designing a GUI-based Python Application for Student Information

tk.Label(root, text="Department:", bg="#e3f2fd").place(x=30,


y=140)
entry_dept = tk.Entry(root, width=30)
entry_dept.place(x=150, y=140)

tk.Label(root, text="Gender:", bg="#e3f2fd").place(x=30, y=170)


gender_var = tk.StringVar()
tk.Radiobutton(root, text="Male",
variable=gender_var, value="Male",
bg="#e3f2fd").place(x=150, y=170)
tk.Radiobutton(root, text="Female",
variable=gender_var, value="Female",
bg="#e3f2fd").place(x=210, y=170)
tk.Radiobutton(root, text="Others",
variable=gender_var, value="Others",
bg="#e3f2fd").place(x=290, y=170)

# Buttons
btn_submit = tk.Button(root, text="Submit Info",
command=submit_info, bg="#a5d6a7", width=15)
btn_submit.place(x=100, y=240)

btn_cancel = tk.Button(root, text="Cancel",


command=close_app, bg="#ef9a9a", width=15)
btn_cancel.place(x=240, y=240)

# Run the app


6
Designing a GUI-based Python Application for Student Information
root.mainloop()

7
Designing a GUI-based Python Application for Student Information

OUTPUT SCREENSHOTS:
1. GUI Window Screenshot
 Shows the main application window with:
o Input fields for First Name, Last Name, Department
o Gender selection using radio buttons
o Login and Cancel buttons
 Clean and centered layout with light blue background

2. Message Box Screenshot


 Displays a pop-up box showing all entered details when Login is clicked

8
Designing a GUI-based Python Application for Student Information

CONCLUSION:
Through this activity, I successfully designed and implemented a GUI-based Python
application using the Tkinter library to collect and display student information. I learned how
to create interactive user interfaces using widgets such as text boxes, radio buttons, and
buttons, and how to arrange them using layout managers like grid(). The activity enhanced
my understanding of event-driven programming, input handling, and message box integration
for user feedback.

What I Learned?
 How to develop a GUI application in Python using Tkinter.
 The use of Tkinter widgets like Entry, Radiobutton, Label, and Button.
 How to manage layouts using the grid() method.
 Writing functions to handle button events (Login and Cancel).
 Displaying user input using message boxes (messagebox.showinfo).
 Running and testing GUI code in Visual Studio Code.

You might also like