├── main.py ├── __pycache__ ├── gui.cpython-312.pyc └── data_structure.cpython-312.pyc ├── README.md ├── data_structure.py └── gui.py /main.py: -------------------------------------------------------------------------------- 1 | from gui import * 2 | 3 | if __name__ == "__main__": 4 | root = Tk() 5 | app = GUI(root) 6 | root.mainloop() 7 | -------------------------------------------------------------------------------- /__pycache__/gui.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tejeswar001/Restaurant-Booking-using-Queue/HEAD/__pycache__/gui.cpython-312.pyc -------------------------------------------------------------------------------- /__pycache__/data_structure.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tejeswar001/Restaurant-Booking-using-Queue/HEAD/__pycache__/data_structure.cpython-312.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Restaurant-Booking-using-Queue 2 | 3 | [Screencast from 2024-09-08 19-58-22.webm](https://github.com/user-attachments/assets/d7b1853d-7b3d-4eee-9d70-404adcba29d5) 4 | 5 | This project is a simple restaurant booking system implemented in Python using `tkinter` for the GUI. It demonstrates how to manage customer bookings using a queue data structure. The system allows users to input customer details such as name and the number of people in the booking. 6 | 7 | ## Features: 8 | - Add bookings with customer name, booking time, and party size. 9 | - Process bookings in a first-come, first-served order. 10 | - Display the current list of bookings in the queue. 11 | - Interactive time selection using dropdown menus for hours and minutes. 12 | 13 | This project is designed to help understand basic queue operations (enqueue, dequeue) and how they can be applied in real-world applications like managing restaurant reservations. 14 | -------------------------------------------------------------------------------- /data_structure.py: -------------------------------------------------------------------------------- 1 | class NODE(): 2 | def __init__(self,name,people): 3 | self.name = name 4 | self.people = people 5 | self.next = None 6 | 7 | class QUEUE(): 8 | def __init__(self): 9 | self.head = None 10 | 11 | def Enqueue(self,name,people): 12 | new = NODE(name,people) 13 | if self.head is None: 14 | self.head = new 15 | else: 16 | node = self.head 17 | while node.next: 18 | node = node.next 19 | node.next = new 20 | 21 | def Dequeue(self): 22 | if self.head is None: 23 | print("Queue is Empty") 24 | else: 25 | node = self.head 26 | self.head = node.next 27 | 28 | def Print_test(self): 29 | queue:list = [] 30 | if self.head is None: 31 | return "Empty" 32 | else: 33 | node = self.head 34 | while node: 35 | print(node.name,node.people) 36 | queue.append(f"{node.name} booking for {node.people}") 37 | node = node.next 38 | return queue 39 | 40 | def is_empty(self): 41 | if self.head is None: 42 | return True 43 | return False -------------------------------------------------------------------------------- /gui.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | from tkinter import messagebox 3 | from data_structure import NODE,QUEUE 4 | 5 | class GUI(): 6 | def __init__(self,root): 7 | self.queue = QUEUE() 8 | self.root = root 9 | self.root.title('Restaurant Booking') 10 | self.root.geometry('500x450') 11 | 12 | self.heading = Label(self.root,text="Booking Interface",font=('arial',25)) 13 | self.heading.pack() 14 | 15 | self.frame1 = Frame(self.root) 16 | self.frame1.pack(padx=20,pady=25) 17 | 18 | self.name_label = Label(self.frame1,text='Enter Name:',font=('arial',15)) 19 | self.name_label.pack(side='left',padx=40) 20 | 21 | self.name_value = StringVar() 22 | self.name_enter = Entry(self.frame1,textvariable=self.name_value,font=('arial',15)) 23 | self.name_enter.pack(side=RIGHT,padx=20) 24 | 25 | self.frame2 = Frame(root) 26 | self.frame2.pack(padx=10,pady=10) 27 | 28 | self.people_label = Label(self.frame2,text="Number of People:",font=('arial',15)) 29 | self.people_label.pack(side=LEFT,padx=10) 30 | 31 | self.people_count = IntVar() 32 | self.people_count.set(0) 33 | self.people_enter = Entry(self.frame2,textvariable=self.people_count,font=('arial',15),width=13) 34 | self.people_enter.pack(side=RIGHT) 35 | 36 | self.frame3 = Frame(root) 37 | self.frame3.pack(pady=20) 38 | 39 | self.button_add = Button(self.frame3,text="Add Booking",command=self.add_booking) 40 | self.button_add.pack(side=LEFT,padx=20) 41 | 42 | self.button_process = Button(self.frame3,text="Process Booking",command=self.process_booking) 43 | self.button_process.pack(side=RIGHT) 44 | 45 | ''' 46 | self.frame4 = Frame(self.root) 47 | self.frame4.pack() 48 | 49 | self.button_view = Button(self.frame4,text="View Bookings",command=self.view_bookings) 50 | self.button_view.pack() 51 | ''' 52 | 53 | self.bookings = Label(self.root,text="No bookings") 54 | self.bookings.pack(pady=25) 55 | 56 | def add_booking(self): 57 | try: 58 | name = self.name_value.get() 59 | people = self.people_count.get() 60 | 61 | if name == "" or people == 0: 62 | return messagebox.showwarning(title="Input error",message="enter a vaild name or no of people") 63 | 64 | self.queue.Enqueue(name,people) 65 | 66 | messagebox.showinfo(title="Processing",message="your booking is successfuly") 67 | 68 | self.name_value.set("") 69 | self.people_count.set("") 70 | 71 | return self.view_bookings() 72 | except Exception as e: 73 | return messagebox.showwarning(title="Input error",message="enter a vaild input") 74 | 75 | def process_booking(self): 76 | self.queue.Dequeue() 77 | 78 | return self.view_bookings() 79 | 80 | def view_bookings(self): 81 | return self.show_bookings() 82 | 83 | def show_bookings(self): 84 | if self.queue.is_empty(): 85 | self.bookings.config(text="No bookings in queue!!") 86 | else: 87 | self.bookings.config(text='\n'.join(self.queue.Print_test())) 88 | --------------------------------------------------------------------------------