hotel management system in python

introduction
The Hotel Management System is a simple, interactive GUI-based desktop application developed using Python’s Tkinter library. This system is designed to assist in managing guest check-ins and check-outs in a hotel. It offers a user-friendly interface where hotel staff can easily enter guest information, assign room types, view a list of currently checked-in guests, and perform check-outs as needed.
This project is an ideal demonstration of how graphical user interfaces can be used to simplify basic hotel operations without the need for complex databases or web applications. It focuses on the fundamental functionality required in hotel guest management while maintaining a clean and intuitive design.
Key Objectives
Collect guest details like name, phone number, and room type
Maintain a temporary list of all checked-in guests
Allow real-time check-in and check-out
Display a summary of all current guests using a text output area
Use message boxes for interaction and feedback
Technologies Used
Python 3
Tkinter (standard GUI toolkit)
Built-in data structures (like lists and dictionaries)
Why This Project?
Demonstrates GUI application development in Python
Encourages good programming practices like OOP (Object-Oriented Programming)
Serves as a foundation for future enhancements like database integration, reporting, and payment processing
Objective
The main objective of this project is to:
Design a basic desktop application to manage hotel guest check-ins and check-outs.
Provide an intuitive graphical user interface using Tkinter.
Store guest details during runtime and display the current list of guests.
Use popup messages for user interaction, such as confirmation and warnings.
Introduce learners to object-oriented programming and GUI development in Python.
Key Features
Guest Information Input
Allows staff to enter guest name, phone number, and room type using input fields.Check-In Functionality
Adds guest details to an internal list and confirms with a messagebox.Guest List Viewer
Displays all currently checked-in guests in a text box with formatted output.Check-Out Functionality
Removes a guest based on the provided name and shows a status message.Dropdown for Room Type
Easy selection of room category like Single, Double, Deluxe, or Suite.User-Friendly Interface
Clean layout with clearly labeled sections, buttons, and outputs.
Technology Stack
Programming Language: Python 3.x
GUI Library: Tkinter (standard Python library)
Data Storage: In-memory (list of dictionaries)
Advantages
Beginner-friendly
No need for internet or database connection
Simple to expand into a full system with file/database support
Lightweight and runs on any desktop with Python installed
flow chart of program

steps to create hotel management system in python
Step 1: Setup Your Environment
Install Python (if not already installed):
👉 Download PythonOpen any Python IDE or editor:
IDLE (comes with Python)
VS Code
PyCharm
Or even a simple text editor + terminal
Step 2: Create a New Python File
Create a file named:
hotel_management.py
Step 3: Import Tkinter Modules
import tkinter as tk
from tkinter import messagebox
tkinter
= Main GUI librarymessagebox
= Pop-up alerts for info or warnings
Step 4: Define the HotelManagement Class
class HotelManagement:
def __init__(self, root):
# GUI layout and initialization here
This will hold all buttons, text boxes, and logic.
Step 5: Create Input Fields
Use Entry
, Label
, and OptionMenu
to create fields:
Guest Name
Phone Number
Room Type (dropdown: Single, Double, Deluxe, Suite)
Step 6: Add Buttons
Add the following buttons:
Check-In – adds guest to the list
Show All Guests – displays all current guests
Check-Out – removes guest by name
Example:
tk.Button(root, text="Check-In", command=self.check_in)
Step 7: Add Output Display
Use a Text
widget to show guest list:
self.output = tk.Text(root, height=12, width=60)
Step 8: Define the Logic Methods
check_in()
– adds guest toself.guests
show_guests()
– displays all guests inText
boxcheck_out()
– removes a guest from list
Step 9: Launch the App
At the end of the file, write:
root = tk.Tk()
app = HotelManagement(root)
root.mainloop()
This starts the GUI loop.
Step 10: Run and Test
Run the script:
python hotel_management.py
Try check-in, view list, and check-out.
Final GUI Preview:
Input fields: Name, Phone, Room Type
Buttons: Check-In, Show All Guests, Check-Out
Guest list area (multi-line text box)
code explanation
Purpose of the App
It simulates a simple hotel check-in/check-out system that:
Accepts guest details (name, phone, room type)
Adds them to a list
Shows all checked-in guests
Allows check-out by guest name
1. Imports and Class Setup
import tkinter as tk
from tkinter import messagebox
tkinter
: Python’s standard GUI librarymessagebox
: Provides pop-up alerts for success or errors
2. HotelManagement Class
class HotelManagement:
def __init__(self, root):
Initializes the GUI app.
root
: The main window.
Window Setup:
self.root.title("🏨 Hotel Management System")
self.root.geometry("500x600")
self.root.config(bg="lightblue")
Sets title, window size, and background color.
Guest List
self.guests = []
Stores guest records as a list of dictionaries.
GUI Widgets and Input Fields
1.Guest Name
self.name_var = tk.StringVar()
tk.Entry(root, textvariable=self.name_var)
Entry box to input guest name.
2.Phone Number
self.phone_var = tk.StringVar()
tk.Entry(root, textvariable=self.phone_var)
Entry box for phone number.
Room Type Dropdown
self.room_var = tk.StringVar()
self.room_menu = tk.OptionMenu(root, self.room_var, "Single", "Double", "Deluxe", "Suite")
Drop-down menu for room types.
Buttons
1.Check-In
tk.Button(root, text="Check-In", command=self.check_in)
Calls
check_in()
to register the guest.
2.Show All Guests
tk.Button(root, text="Show All Guests", command=self.show_guests)
Displays all current guests in a text area.
3.Check-Out
tk.Button(root, text="Check-Out Guest", command=self.check_out)
Calls
check_out()
to remove a guest by name.
4.Output Display
self.output = tk.Text(root, height=12, width=60)
Multi-line text box to display guest list.
Methods Functionality
1. check_in()
def check_in(self):
name = self.name_var.get()
phone = self.phone_var.get()
room = self.room_var.get()
Gets values from the input fields.
Checks if name and phone are not empty.
Adds a dictionary of guest info to
self.guests
.Shows success message or warning.
2. show_guests()
def show_guests(self):
self.output.delete(1.0, tk.END)
Clears the text area.
Lists all guests with serial number, name, phone, and room type.
3. check_out()
def check_out(self):
name = self.name_var.get()
Searches the guest list by name (case insensitive).
Removes the matching guest.
Shows a messagebox for success or “not found”.
Running the Application
root = tk.Tk()
app = HotelManagement(root)
root.mainloop()
Creates a
tkinter
window.Launches the app by instantiating the
HotelManagement
class.Starts the GUI event loop.
Example Use Case
User enters: Name = “John”, Phone = “9876543210”, Room = “Deluxe”
Clicks Check-In
Guest added to the list
Clicks Show All Guests to see list
To remove: enter “John” again and click Check-Out
source code
import tkinter as tk
from tkinter import messagebox
class HotelManagement:
def __init__(self, root):
self.root = root
self.root.title("🏨 Hotel Management System")
self.root.geometry("500x600")
self.root.config(bg="lightblue")
self.guests = []
# Title
tk.Label(root, text="Hotel Check-In System", font=("Arial", 18, "bold"), bg="skyblue").pack(pady=10)
# Guest Info
self.name_var = tk.StringVar()
self.phone_var = tk.StringVar()
self.room_var = tk.StringVar()
tk.Label(root, text="Guest Name:", font=("Arial", 12), bg="lightblue").pack(pady=5)
tk.Entry(root, textvariable=self.name_var, font=("Arial", 12)).pack()
tk.Label(root, text="Phone Number:", font=("Arial", 12), bg="lightblue").pack(pady=5)
tk.Entry(root, textvariable=self.phone_var, font=("Arial", 12)).pack()
tk.Label(root, text="Room Type:", font=("Arial", 12), bg="lightblue").pack(pady=5)
self.room_menu = tk.OptionMenu(root, self.room_var, "Single", "Double", "Deluxe", "Suite")
self.room_menu.config(font=("Arial", 12))
self.room_var.set("Single")
self.room_menu.pack()
# Buttons
tk.Button(root, text="Check-In", command=self.check_in, bg="green", fg="white", font=("Arial", 12)).pack(pady=10)
tk.Button(root, text="Show All Guests", command=self.show_guests, bg="blue", fg="white", font=("Arial", 12)).pack(pady=5)
tk.Button(root, text="Check-Out Guest", command=self.check_out, bg="red", fg="white", font=("Arial", 12)).pack(pady=5)
self.output = tk.Text(root, height=12, width=60)
self.output.pack(pady=10)
def check_in(self):
name = self.name_var.get()
phone = self.phone_var.get()
room = self.room_var.get()
if name and phone:
guest = {"Name": name, "Phone": phone, "Room": room}
self.guests.append(guest)
messagebox.showinfo("Success", f"{name} checked into {room} room.")
self.name_var.set("")
self.phone_var.set("")
self.room_var.set("Single")
else:
messagebox.showwarning("Missing Info", "Please fill all fields.")
def show_guests(self):
self.output.delete(1.0, tk.END)
if not self.guests:
self.output.insert(tk.END, "No guests currently.\n")
else:
for i, g in enumerate(self.guests, 1):
self.output.insert(tk.END, f"{i}. {g['Name']} | {g['Phone']} | {g['Room']}\n")
def check_out(self):
name = self.name_var.get()
for g in self.guests:
if g["Name"].lower() == name.lower():
self.guests.remove(g)
messagebox.showinfo("Checked Out", f"{name} has been checked out.")
return
messagebox.showwarning("Not Found", f"{name} not found in guest list.")
# Run the App
root = tk.Tk()
app = HotelManagement(root)
root.mainloop()
output


