0% found this document useful (0 votes)
7 views19 pages

Avuykt

Uploaded by

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

Avuykt

Uploaded by

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

Computer Science Project Report

Name: Fawaz Shaik


Class: 12
Year: 2023-2024
Contents

 Acknowledgement
 Introduction
 Hardware and Software requirements
 Why Python ?
 Source Code
 Out Put Series
 Further Development
Acknowledgment

I would like to extend my sincere appreciation and gratitude to the


following individuals and entities who played a crucial role in the
development of the Movie Ticket Booking System project:
New Era Academy
Principal , Mrs Babita Jaiswal
Thank you to Principal Babita mam for fostering an environment that
encourages creativity and innovation. Your support has been instrumental
in the realization of this project.
Computer Science Teacher , Rajat sir:
A special acknowledgment to Rajat sir, our dedicated computer science
teacher, for their guidance, mentorship, and unwavering support
throughout the development process. Their expertise and encouragement
have been invaluable.
Friends
Heartfelt thanks to all my friends for their continuous encouragement,
feedback, and moral support. Your enthusiasm and shared excitement
made this project an enjoyable and collaborative journey.
Introduction

The Movie Ticket Booking System is a software application designed to


streamline and automate the process of booking movie tickets for
customers. This system provides an interactive graphical user interface
(GUI) built using Tkinter, a popular GUI toolkit for Python. The backend
of the application utilizes MySQL for database management.
Features:
User Authentication:
Users can log in with a registered username and password. New users
have the option to register, creating a new account for future logins.
Movie Selection:
After successful login, users can select a movie from the available
options. Date and time options for each movie are presented for selection.
Seat Booking:
Users can choose their seats for the selected movie, date, and time. A
graphical representation of available seats allows users to make informed
choices.
Payment Processing:
Once seats are selected, users proceed to the payment screen. The system
calculates the total amount based on the number of selected seats and a
predefined seat price.
Users can complete the payment process to confirm their booking.
Implementation:
Frontend: Tkinter
Tkinter is used to create an intuitive and user-friendly interface for users
to interact with the system.
Screens include login, movie selection, seat booking, and payment.

Backend: MySQL
MySQL is employed to store and manage user data, movie details, and
booking information.
SQL queries are executed to check login credentials, retrieve movie
details, and update seat bookings
How to Run:
Ensure Python, Tkinter, and MySQL Connector/Python are installed. Set
up the MySQL database and table as specified in the code.
Update the database connection parameters in the code.
Run the Python script.
This Movie Ticket Booking System provides a seamless and user-friendly
experience for customers to browse, select, and book movie tickets,
enhancing the efficiency of the ticket booking process. Users can enjoy
the convenience of reserving their preferred seats with just a few clicks.
Hardware And Software Requirements

Hardware Requirements:
Computer: Any standard desktop or laptop computer should be sufficient.

Operating System: The code should work on Windows, macOS, or Linux.


Ensure your operating system is supported by both Python and Tkinter.

MySQL Server: Since the code connects to a MySQL database, you need
access to a MySQL server. If you don't have one installed locally, you
might consider using a remote MySQL server.

Internet Connection: If you are using a remote MySQL server, you will
need an internet connection to connect to it.

Software Requirements:
Python: Ensure you have Python installed on your system. You can
download the latest version of Python from the official website.

Tkinter: Tkinter is included with most Python installations, so you


generally don't need to install it separately. However, for some systems,
you might need to install the Tkinter package explicitly. You can usually
install it using the package manager for your operating system.

MySQL Connector/Python: The code uses MySQL as a database


backend, so you'll need to have the MySQL Connector/Python
installed.You can install it using the following command:
pip install mysql-connector-python
Why Python ?

Python is a high-level, interpreted, interactive, and object-oriented


scripting language. Python was designed to be highly readable which uses
English keywords frequently whereas other languages use punctuation
and it has fewer syntactical constructions than other languages.

It is used in :

1. Software Development
2. Web Development
3. System Scripting
4. Mathematics

Python is Interpreted

It means that each line is processed one by one at runtime by the


interpreter and you do not need to compile your program before
executing it.

Python is Interactive

It means that you can actually sit at a Python prompt and interact with the
interpreter directly, to write and execute your programs.

Python supports the Object-Oriented style or technique of programming


that encapsulates code within objects

Python's success is that its source code is fairly easy-to-maintain. One


reason for that is, it is read and written like a lot of everyday English.
One of Python's greatest strengths is the bulk of the library, which makes
it very portable and cross-platform compatible. Python has libraries for
almost everything one can think of
Python can run on a wide variety of hardware platforms and has the same
interface on all platforms. You can run the same python program on
Windows, Linux, Mac, Raspberry Pi, Mango Pi, Android, etc
Python provides interfaces to all major commercial databases. It has
packages to communicate with SQL, NoSQL, etc. databases, ranging
from MongoDB to MySQL.
Mysql Content

Database used: MovieTicketDB


Tables used:

 Bookings
 Movies
 Users

Tables Bookings:

Table Movies:
Table Users:
Source Code
import tkinter as tk
from tkinter import messagebox
import mysql.connector
from tkinter import ttk

# Database Configuration
DB_CONFIG = {
"host": "localhost",
"user": "root",
"password": "",
"database": "MovieTicketDB"
}

# Function to check login credentials


def login():
username = entry_username.get()
password = entry_password.get()

if not username or not password:


messagebox.showerror("Login Failed", "Username and Password
cannot be empty.")
return

try:
db = mysql.connector.connect(**DB_CONFIG)
cursor = db.cursor()

query = "SELECT * FROM users WHERE username=%s AND


password=%s"
cursor.execute(query, (username, password))
result = cursor.fetchone()

if result:
open_movie_selection_screen()
else:
messagebox.showerror("Login Failed", "Invalid username or
password")
db.close()
except mysql.connector.Error as err:
messagebox.showerror("Database Error", f"Error: {err}")
# Function to open the movie selection screen
def open_movie_selection_screen():
movie_selection_window = tk.Toplevel(root)
movie_selection_window.title("Movie Selection")
movie_selection_window.geometry("800x600")

label_movie_selection = tk.Label(movie_selection_window, text="Select


a Movie", font=("Helvetica", 20))
label_movie_selection.pack(pady=20)

# Fetch movies from the database


try:
db = mysql.connector.connect(**DB_CONFIG)
cursor = db.cursor()
cursor.execute("SELECT name FROM movies")
movies = [row[0] for row in cursor.fetchall()]
db.close()
except mysql.connector.Error as err:
messagebox.showerror("Database Error", f"Error: {err}")
return

if not movies:
messagebox.showinfo("No Movies", "No movies available. Please try
again later.")
movie_selection_window.destroy()
return

movie_combobox = ttk.Combobox(movie_selection_window,
values=movies)
movie_combobox.pack()
movie_combobox.set(movies[0])

label_date_selection = tk.Label(movie_selection_window, text="Select


Date", font=("Helvetica", 16))
label_date_selection.pack(pady=10)

date_combobox = ttk.Combobox(movie_selection_window,
values=["2023-12-15", "2023-12-16", "2023-12-17"])
date_combobox.pack()
date_combobox.set("2023-12-15")

label_time_selection = tk.Label(movie_selection_window, text="Select


Time", font=("Helvetica", 16))
label_time_selection.pack(pady=10)

time_combobox = ttk.Combobox(movie_selection_window,
values=["10:00 AM", "2:00 PM", "6:00 PM"])
time_combobox.pack()
time_combobox.set("10:00 AM")

def open_seat_booking_screen():
selected_movie = movie_combobox.get()
selected_date = date_combobox.get()
selected_time = time_combobox.get()

if not selected_movie or not selected_date or not selected_time:


messagebox.showerror("Error", "Please select all options.")
return

seat_booking_window = tk.Toplevel(movie_selection_window)
seat_booking_window.title("Seat Booking")
seat_booking_window.geometry("800x600")

label_seat_booking = tk.Label(seat_booking_window, text="Select


Your Seats", font=("Helvetica", 20))
label_seat_booking.grid(row=0, column=0, columnspan=7, pady=20)

def book_seat(row, col):


if seats[row * num_cols + col]["bg"] == "green":
seats[row * num_cols + col].configure(bg="red")
else:
seats[row * num_cols + col].configure(bg="green")

num_rows = 7
num_cols = 7
seats = []

for row in range(num_rows):


for col in range(num_cols):
seat = tk.Button(seat_booking_window, text=f"Seat {row *
num_cols + col + 1}", width=3, height=1, bg="green",
command=lambda r=row, c=col: book_seat(r, c))
seat.grid(row=row + 1, column=col + 1, padx=5, pady=5)
seats.append(seat)

def confirm_selection():
selected_seats = [f"Seat {r * num_cols + c + 1}" for r in
range(num_rows) for c in range(num_cols) if
seats[r * num_cols + c]["bg"] == "red"]
if not selected_seats:
messagebox.showinfo("Selection Confirmation", "No seats
selected.")
else:
total_amount = len(selected_seats) * 10
messagebox.showinfo("Selection Confirmation", f"Total Amount:
${total_amount}\nSelected Seats:\n" + "\n".join(selected_seats))
confirm_button = tk.Button(seat_booking_window, text="Confirm
Selection", command=confirm_selection)
confirm_button.grid(row=num_rows + 1, column=0, columnspan=7,
pady=20)

ok_button = tk.Button(movie_selection_window, text="OK",


command=open_seat_booking_screen)
ok_button.pack(pady=20)

# Function to open the registration screen


def open_registration_screen():
registration_window = tk.Toplevel(root)
registration_window.title("Register")
registration_window.geometry("400x300")

label_register = tk.Label(registration_window, text="Register",


font=("Helvetica", 24))
label_register.pack(pady=20)

label_new_username = tk.Label(registration_window, text="New


Username:")
entry_new_username = tk.Entry(registration_window)
label_new_password = tk.Label(registration_window, text="New
Password:")
entry_new_password = tk.Entry(registration_window, show="*")

label_new_username.pack()
entry_new_username.pack()
label_new_password.pack()
entry_new_password.pack()

def register_user():
new_username = entry_new_username.get()
new_password = entry_new_password.get()

if not new_username or not new_password:


messagebox.showerror("Error", "All fields are required.")
return

try:
db = mysql.connector.connect(**DB_CONFIG)
cursor = db.cursor()

query = "INSERT INTO users (username, password) VALUES (%s,


%s)"
cursor.execute(query, (new_username, new_password))
db.commit()
messagebox.showinfo("Registration Successful", "User registered
successfully.")
db.close()
except mysql.connector.IntegrityError:
messagebox.showerror("Registration Failed", "Username already
exists.")
except mysql.connector.Error as err:
messagebox.showerror("Database Error", f"Error: {err}")

register_button = tk.Button(registration_window, text="Register",


command=register_user)
register_button.pack()

# Main Window
root = tk.Tk()
root.title("Movie Ticket Booking System")
root.geometry("1000x800")

heading = tk.Label(root, text="Login", font=("Helvetica", 24))


heading.pack(pady=20)

label_username = tk.Label(root, text="Username:")


entry_username = tk.Entry(root)
label_password = tk.Label(root, text="Password:")
entry_password = tk.Entry(root, show="*")

label_username.place(x=400, y=400)
entry_username.place(x=500, y=400)
label_password.place(x=400, y=450)
entry_password.place(x=500, y=450)

login_button = tk.Button(root, text="Login", command=login)


login_button.place(x=500, y=500)

register_button = tk.Button(root, text="Register",


command=open_registration_screen)
register_button.place(x=600, y=500)

root.mainloop()
Output Screen
Further Development

 Storage of seats in SQL


 Snacks
 Payment screen
Bibliography

 Sumitha Arora Class 11 TextBook


 Sumitha Arora Class 12 TextBook
 https://docs.python.org/3/library/tkinter.html

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy