Avuykt
Avuykt
Acknowledgement
Introduction
Hardware and Software requirements
Why Python ?
Source Code
Out Put Series
Further Development
Acknowledgment
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.
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.
It is used in :
1. Software Development
2. Web Development
3. System Scripting
4. Mathematics
Python is Interpreted
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.
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"
}
try:
db = mysql.connector.connect(**DB_CONFIG)
cursor = db.cursor()
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")
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])
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")
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()
seat_booking_window = tk.Toplevel(movie_selection_window)
seat_booking_window.title("Seat Booking")
seat_booking_window.geometry("800x600")
num_rows = 7
num_cols = 7
seats = []
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)
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()
try:
db = mysql.connector.connect(**DB_CONFIG)
cursor = db.cursor()
# Main Window
root = tk.Tk()
root.title("Movie Ticket Booking System")
root.geometry("1000x800")
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)
root.mainloop()
Output Screen
Further Development