Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #LoginWindow.py
- from tkinter import *
- from PIL import ImageTk, Image
- from pygame._sdl2 import messagebox
- from tkcalendar import Calendar
- import connection
- class LoginForm:
- def _init_(self, window):
- self.window = window
- self.window.geometry('1200x628')
- self.window.resizable(0, 0)
- self.window.state('zoomed')
- # Background image
- self.bg_frame = Image.open('images\\background1.png')
- photo = ImageTk.PhotoImage(self.bg_frame)
- self.bg_panel = Label(self.window, image=photo)
- self.bg_panel.image = photo
- self.bg_panel.pack(fill='both', expand='yes')
- # Login frame
- self.lgn_frame = Frame(self.window, bg='black', width='843', height='777')
- self.lgn_frame.place(x=300, y=25)
- self.txt = 'WELCOME'
- self.heading = Label(self.lgn_frame, text=self.txt, font=('yu gothic ui', 25, 'bold'), bg='black', fg='white')
- self.heading.place(x=80, y=30, width=300, height=30)
- # Left side image
- self.side_image = Image.open('images\\trainnobg.jpg')
- photo = ImageTk.PhotoImage(self.side_image)
- self.side_image_label = Label(self.lgn_frame, image=photo, bg='#040405')
- self.side_image_label.image = photo
- self.side_image_label.place(x=-5, y=-159, width=600, height=900)
- # Sign in image
- self.sign_in_image = Image.open('images\\irctclogo.png')
- photo = ImageTk.PhotoImage(self.sign_in_image)
- self.sign_in_image_label = Label(self.lgn_frame, image=photo, bg='black')
- self.sign_in_image_label.image = photo
- self.sign_in_image_label.place(x=750, y=75)
- # Book Ticket label
- self.sign_in_image_label = Label(self.lgn_frame, text='Book Ticket', bg='#040405', fg='white', font=('yu gothic ui', 13, 'bold'))
- self.sign_in_image_label.place(x=663, y=300)
- # From location
- self.username_label = Label(self.lgn_frame, text='From: ', bg='#040405', font=('yu gothic ui', 13, 'bold'), fg='white')
- self.username_label.place(x=600, y=350)
- self.from_entry = Entry(self.lgn_frame, highlightthickness=0, relief=FLAT, bg='#040405', fg='white', font=('yu gothic ui', 13, 'bold'))
- self.from_entry.place(x=685, y=350, width=270)
- self.username_line = Canvas(self.lgn_frame, width=300, height=2.0, bg='#bdb9b1', highlightthickness=0)
- self.username_line.place(x=600, y=375)
- # To location
- self.username_label = Label(self.lgn_frame, text='To: ', bg='#040405', font=('yu gothic ui', 13, 'bold'), fg='white')
- self.username_label.place(x=600, y=450)
- self.to_entry = Entry(self.lgn_frame, highlightthickness=0, relief=FLAT, bg='#040405', fg='white', font=('yu gothic ui', 13, 'bold'))
- self.to_entry.place(x=685, y=450, width=270)
- self.username_line = Canvas(self.lgn_frame, width=300, height=2.0, bg='#bdb9b1', highlightthickness=0)
- self.username_line.place(x=600, y=475)
- # Seats
- self.username_label = Label(self.lgn_frame, text='Seats: ', bg='#040405', font=('yu gothic ui', 13, 'bold'), fg='white')
- self.username_label.place(x=600, y=520)
- self.seats_entry = Entry(self.lgn_frame, highlightthickness=0, relief=FLAT, bg='#040405', fg='white', font=('yu gothic ui', 13, 'bold'))
- self.seats_entry.place(x=685, y=520, width=270)
- # Scrollbar
- scrollbar_frame = Frame(self.lgn_frame, bg='#040405')
- scrollbar_frame.place(x=600, y=575, height=100)
- scrollbar_canvas = Canvas(scrollbar_frame, bg='#040405', highlightthickness=0)
- scrollbar_canvas.pack(side=LEFT, fill=BOTH, expand=True)
- scrollbar = Scrollbar(scrollbar_frame, orient=VERTICAL, command=scrollbar_canvas.yview)
- scrollbar.pack(side=RIGHT, fill=Y)
- options = ['General', 'Ladies', 'Lower Berth', 'Person with Disability', 'Tatkal', 'Duty Pass']
- self.option_listbox = Listbox(scrollbar_canvas, bg='#040405', fg='white', bd=0, highlightthickness=0, font=('yu gothic ui', 12, 'bold'))
- self.username_line = Canvas(self.lgn_frame, width=300, height=2.0, bg='#bdb9b1', highlightthickness=0)
- self.username_line.place(x=600, y=550)
- for option in options:
- self.option_listbox.insert(END, option)
- self.option_listbox.pack(side=LEFT, fill=BOTH, expand=True)
- self.option_listbox.config(yscrollcommand=scrollbar.set)
- # Label to display selected item
- self.selected_label = Label(self.lgn_frame, text="", bg="#040405", fg="white",
- font=('yu gothic ui', 12, 'bold'))
- self.selected_label.place(x=680, y=520)
- # Bind listbox select event
- self.option_listbox.bind("<<ListboxSelect>>", self.on_select)
- # Date
- self.date_label = Label(self.lgn_frame, text='Date: ', bg='#040405', font=('yu gothic ui', 13, 'bold'), fg='white')
- self.date_label.place(x=315, y=500)
- self.username_line = Canvas(self.lgn_frame, width=250, height=2.0, bg='#bdb9b1', highlightthickness=0)
- self.username_line.place(x=315, y=545)
- self.cal = Calendar(self.lgn_frame, selectmode="day", year=2024, month=2, day=18, background='#040405',
- foreground='white', headersbackground='#040405', headersforeground='white')
- self.cal.place(x=300, y=570, width=270)
- # Button to get selected date
- self.get_date_button = Button(self.lgn_frame, text="Get Date", command=self.get_date, bg='#040405', fg='white',
- font=('yu gothic ui', 13, 'bold'))
- self.get_date_button.place(x=390, y=502, height=25, width=75)
- # Label to display selected date
- self.selected_date_label = Label(self.lgn_frame, text="", bg="#040405", fg="white", font=('yu gothic ui', 12, 'bold'))
- self.selected_date_label.place(x=480, y=500)
- # Search button
- self.search_button = Button(self.lgn_frame, text="Search", bg='red', fg='white', font=('yu gothic ui', 13, 'bold'), command=self.search_trains_wrapper, cursor='hand2')
- self.search_button.place(x=600, y=695, height=30, width=100)
- def get_date(self):
- selected_date = self.cal.get_date()
- self.selected_date_label.config(text=selected_date)
- def on_select(self, event):
- selection = event.widget.curselection()
- if selection:
- index = selection[0]
- data = event.widget.get(index)
- self.selected_label.config(text=data)
- def fetch_available_dates(self, ac_tier):
- available_dates = [f"2024-03-{day}" for day in range(20, 31)]
- return available_dates
- def display_available_dates(self, ac_tier):
- available_dates = self.fetch_available_dates(ac_tier)
- dates_window = Toplevel(self.window)
- dates_window.title(f"Available Dates for {ac_tier}")
- dates_window.geometry('1500x400')
- dates_frame = Frame(dates_window, bg='#040405')
- dates_frame.pack(fill='both', expand=True)
- dates_label = Label(dates_frame, text=f"Available Dates for {ac_tier}", bg='#040405', fg='white', font=('yu gothic ui', 16, 'bold'))
- dates_label.pack(pady=10)
- # Create a horizontal scrollbar to display dates
- dates_canvas = Canvas(dates_frame, bg='#040405', highlightthickness=0)
- dates_canvas.pack(side=TOP, fill=BOTH, expand=True)
- scrollbar = Scrollbar(dates_frame, orient=HORIZONTAL, command=dates_canvas.xview)
- scrollbar.pack(side=BOTTOM, fill=X)
- dates_canvas.configure(xscrollcommand=scrollbar.set)
- dates_frame_inner = Frame(dates_canvas, bg='#040405')
- dates_canvas.create_window((0, 0), window=dates_frame_inner, anchor='nw')
- # Add dates to the frame
- for i, date in enumerate(available_dates):
- date_button = Button(dates_frame_inner, text=date, bg='red', fg='white', font=('yu gothic ui', 12, 'bold'))
- date_button.grid(row=0, column=i, padx=5, pady=5)
- # Update scroll region
- dates_frame_inner.update_idletasks()
- dates_canvas.config(scrollregion=dates_canvas.bbox("all"))
- def search_trains_wrapper(self):
- from_location = self.from_entry.get()
- to_location = self.to_entry.get()
- date = self.cal.get_date()
- if not (from_location and to_location and date):
- # If any of the fields are empty, display a message
- messagebox.showerror("Error", "Please fill in all the required fields.")
- return
- # Call search_trains function from connection module
- results = connection.search_trains(from_location, to_location, date)
- # Display search results
- if results:
- self.display_search_results(results)
- else:
- messagebox.showinfo("No Results", "No trains found for the given criteria.")
- def display_search_results(self, results):
- # Function to display search results
- # You can update this method to display the results in a separate window or in the current window
- results_window = Toplevel(self.window)
- results_window.title("Search Results")
- results_window.geometry('800x600')
- # Create a frame to hold the results
- results_frame = Frame(results_window, bg='#040405')
- results_frame.pack(fill='both', expand=True)
- # Add a label for the heading
- heading_label = Label(results_frame, text="Search Results", bg='#040405', fg='white',
- font=('yu gothic ui', 18, 'bold'))
- heading_label.pack(pady=10)
- if results:
- # Iterate over the results and display them
- for result in results:
- train_frame = Frame(results_window, bg='#040405')
- train_frame.pack(fill='both', expand=True)
- result_label = Label(results_frame, text=result, bg='#040405', fg='white', font=('yu gothic ui', 12))
- result_label.pack(pady=15, padx=10)
- else:
- # If no results found, display a message
- no_results_label = Label(results_frame, text="No trains found for the given criteria.", bg='#040405',
- fg='white', font=('yu gothic ui', 12))
- no_results_label.pack(pady=10)
- close_button = Button(results_frame, text="Close", command=results_window.destroy, bg='red', fg='white',font=('yu gothic ui', 12, 'bold'),cursor='hand2')
- close_button.place(x=350, y=380)
- ACTier1A = Button(results_frame, text="AC Tier 1", bg='red', fg='white', font=('yu gothic ui', 12, 'bold'), command=lambda: self.display_available_dates("AC Tier 1"), cursor='hand2')
- ACTier1A.place(x=200, y=110)
- ACTier2A = Button(results_frame, text="AC Tier 2", bg='red', fg='white', font=('yu gothic ui', 12, 'bold'), command=lambda: self.display_available_dates("AC Tier 2"), cursor='hand2')
- ACTier2A.place(x=350, y=110)
- ACTier1A = Button(results_frame, text="AC Tier 1", bg='red', fg='white', font=('yu gothic ui', 12, 'bold'), command=lambda: self.display_available_dates("AC Tier 1"), cursor='hand2')
- ACTier1A.place(x=200, y=190)
- ACTier2A = Button(results_frame, text="AC Tier 2", bg='red', fg='white', font=('yu gothic ui', 12, 'bold'), command=lambda: self.display_available_dates("AC Tier 2"), cursor='hand2')
- ACTier2A.place(x=350, y=190)
- def fetch_available_dates(self, ac_tier):
- available_dates = [f"2024-03-{day}" for day in range(20, 31)] # Mocked available dates
- return available_dates
- def fetch_available_seats(self, ac_tier, selected_date):
- # Mocking the seat types based on selected_date and AC tier
- seat_types = {
- "2024-03-20": ["A-21", "B-42", "B-35", "C-44", "C-45"],
- "2024-03-21": ["A-26", "A-27", "B-28", "B-29"],
- "2024-03-22": ["A-30", "A-31", "B-32", "D-11"],
- "2024-03-23": ["A-33", "A-34", "B-35", "C-36", "C-37", "D-12"],
- "2024-03-24": ["A-38", "A-39", "B-40", "C-42", "C-43", "C-44", "D-22"],
- "2024-03-25": ["A-40", "A-41", "B-42", "C-42", "C-46", "C-44", "D-11"],
- "2024-03-26": ["B-42", "B-43", "B-44", "C-11"],
- "2024-03-27": ["A-11", "B-42", "C-42", "B-19"],
- "2024-03-28": ["A-21", "B-42", "C-42", "B-20", "C-20", "D-12"],
- "2024-03-29": ["A-32, B-26", "C-38", "B-7"],
- "2024-03-30": ["A-33", "C-39", "B-40", "C-45,A-41"],
- }
- return seat_types.get(selected_date, [])
- def display_available_dates(self, ac_tier):
- available_dates = self.fetch_available_dates(ac_tier)
- dates_window = Toplevel(self.window)
- dates_window.title(f"Available Dates for {ac_tier}")
- dates_window.geometry('1500x400')
- dates_frame = Frame(dates_window, bg='#040405')
- dates_frame.pack(fill='both', expand=True)
- dates_label = Label(dates_frame, text=f"Available Dates for {ac_tier}", bg='#040405', fg='white',
- font=('yu gothic ui', 16, 'bold'))
- dates_label.pack(pady=10)
- # Create a horizontal scrollbar to display dates
- dates_canvas = Canvas(dates_frame, bg='#040405', highlightthickness=0)
- dates_canvas.pack(side=TOP, fill=BOTH, expand=True)
- scrollbar = Scrollbar(dates_frame, orient=HORIZONTAL, command=dates_canvas.xview)
- scrollbar.pack(side=BOTTOM, fill=X)
- dates_canvas.configure(xscrollcommand=scrollbar.set)
- dates_frame_inner = Frame(dates_canvas, bg='#040405')
- dates_canvas.create_window((0, 0), window=dates_frame_inner, anchor='nw')
- # Add date buttons to the frame
- for i, date in enumerate(available_dates):
- date_button = Button(dates_frame_inner, text=date, bg='red', fg='white', font=('yu gothic ui', 12, 'bold'),
- command=lambda d=date: self.display_available_seats(ac_tier, d))
- date_button.grid(row=0, column=i, padx=5, pady=5)
- # Update scroll region
- dates_frame_inner.update_idletasks()
- dates_canvas.config(scrollregion=dates_canvas.bbox("all"))
- def display_available_seats(self, ac_tier, selected_date):
- available_seats = self.fetch_available_seats(ac_tier, selected_date)
- seats_window = Toplevel(self.window)
- seats_window.title(f"Available Seats for {ac_tier} on {selected_date}")
- seats_window.geometry('500x400')
- seats_frame = Frame(seats_window, bg='#040405')
- seats_frame.pack(fill='both', expand=True)
- seats_label = Label(seats_frame, text=f"Available Seats for {ac_tier} on {selected_date}", bg='#040405',
- fg='white', font=('yu gothic ui', 16, 'bold'))
- seats_label.pack(pady=10)
- if available_seats:
- for i, seat_type in enumerate(available_seats):
- seat_button = Button(seats_frame, text=seat_type, bg='red', fg='white',
- font=('yu gothic ui', 12, 'bold'))
- seat_button.pack(pady=5)
- else:
- no_seats_label = Label(seats_frame, text="No seats available for the selected date.", bg='#040405',
- fg='white', font=('yu gothic ui', 12))
- no_seats_label.pack(pady=10)
- def page():
- window = Tk()
- LoginForm(window)
- window.mainloop()
- if _name_ == '_main_':
- page()
- #signin.py
- from tkinter import *
- from tkinter.filedialog import Open
- from PIL import ImageTk
- def display_login_window():
- login_window = Tk()
- login_window.resizable(False, False)
- login_window.title("Login Page")
- login_window.geometry('1080x566')
- def hide():
- openeye.config(file='eye (1).png')
- passwordEntry.config(show='*')
- eyeButton.config(command=show)
- def show():
- openeye.config(file='visual (1).png')
- passwordEntry.config(show='')
- eyeButton.config(command=hide)
- def user_enter(event):
- if usernameEntry.get()=='Username':
- usernameEntry.delete(0,END)
- def password_enter(event):
- if passwordEntry.get()=='Password':
- passwordEntry.delete(0,END)
- login_window = Tk()
- login_window.resizable(False, False)
- login_window.title("Login Page")
- login_window.geometry('1080x566')
- bgImage = ImageTk.PhotoImage(file='bg_login.jpg')
- bgLabel = Label(login_window, image=bgImage)
- bgLabel.grid(row=0, column=0)
- bgLabel.place(x=0,y=0)
- heading = Label(login_window,text='USER LOGIN', font=('Microsoft YaHei UI', 15, 'bold'), fg='navy')
- heading.place(x=765, y=100)
- usernameEntry=Entry(login_window, width=25, font=('Microsoft YaHei UI', 10, 'bold'),bd=0, fg='black')
- usernameEntry.place(x=730, y=150)
- usernameEntry.insert(0,'Username')
- usernameEntry.bind('<FocusIn>', user_enter)
- Frame(login_window, width=200, height=2, bg='navy').place(x=730, y=175)
- passwordEntry = Entry(login_window, width=25, font=('Microsoft YaHei UI', 10, 'bold'), bd=0, fg='black')
- passwordEntry.place(x=730, y=185)
- passwordEntry.insert(0,'Password')
- passwordEntry.bind('<FocusIn>', password_enter)
- Frame(login_window, width=200, height=2, bg='navy').place(x=730, y=205)
- openeye=PhotoImage(file='visual (1).png')
- eyeButton = Button(login_window,image=openeye, bd=0, bg='white', activebackground='white', cursor='hand2', command=hide)
- eyeButton.place(x=910,y=190)
- forgetButton = Button(login_window,text='Forgot Password?', bd=0, bg='white', activebackground='white', cursor='hand2', font=('Microsoft YaHei UI',8,'bold'), fg='navy', activeforeground='navy')
- forgetButton.place(x=830,y=210)
- loginButton=Button(login_window, text='Login', font=('Open Sans', 12, 'bold'), fg='white', bg='navy', activeforeground='white', activebackground='navy', cursor='hand2', bd=0, width=19)
- loginButton.place(x=735, y=250)
- orLabel = Label(login_window, text='-----------------OR----------------', font=('Open Sans',12,'bold'), fg='navy', bg='white')
- orLabel.place(x=737, y=290)
- fb_logo=PhotoImage(file='fblogo (1).png')
- fb_Label = Label(login_window, image=fb_logo)
- fb_Label.place(x=737, y=320)
- x_logo = PhotoImage(file='xlogo (1).png')
- x_Label = Label(login_window, image=x_logo)
- x_Label.place(x=817, y=320)
- google_logo = PhotoImage(file='googlelogo (1).png')
- google_Label = Label(login_window, image=google_logo)
- google_Label.place(x=887, y=320)
- signupLabel = Label(login_window, text='Don`t have any account?', font=('Open Sans',8,'bold'), fg='navy', bg='white')
- signupLabel.place(x=770, y=350)
- CreatenewaccButton = Button(login_window, text='Create a new one', font=('Open Sans', 9, 'bold underline'), fg='navy', bg='white', activeforeground='navy', cursor='hand2', bd=0)
- CreatenewaccButton.place(x=740, y=380)
- login_window.mainloop()
- #connection.py
- def search_trains(from_location, to_location, date):
- # Assuming the date is in the format 'YYYY-MM-DD'
- if from_location.lower() == "mumbai" and to_location.lower() == "delhi" or from_location.lower() == "delhi" and to_location.lower() == "mumbai":
- # Dummy timetable for trains from Mumbai to Delhi
- timetable = {
- #month/day/year
- "3/4/24": ["NZM RAJDHANIs - Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/5/24": ["NZM RAJDHANIs - Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/6/24": ["NZM RAJDHANIs - Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/7/24": ["NZM RAJDHANIs - Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/8/24": ["NZM RAJDHANIs - Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/9/24": ["NZM RAJDHANIs - Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/10/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/11/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/12/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/13/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/14/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/15/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/16/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/17/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/18/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/19/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/20/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/21/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/22/24": ["NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/23/24": [
- "NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/24/24": [
- "NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/25/24": [
- "NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/26/24": [
- "NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/27/24": [
- "NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/28/24": [
- "NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/29/24": [
- "NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/30/24": [
- "NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- "3/31/24": [
- "NZM RAJDHANIs -Departure: 08:00 AM, Arrival: 06:00 AM \n\n\n\n Tejas express - Departure: 10:00 AM, Arrival: 06:00 AM\n\n\n"],
- }
- elif from_location.lower() == "mumbai" and to_location.lower() == "chennai" or from_location.lower() == "chennai" and to_location.lower() == "mumbai":
- # Dummy timetable for trains from Mumbai to Chennai
- timetable = {
- "3/5/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/6/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/7/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\nMumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/8/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/9/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/10/24": [ "Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/11/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/12/24": [ "Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/13/24": [ "Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/14/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/15/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/16/24": [ "Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/17/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/18/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/19/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/20/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/21/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/22/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/23/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/24/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/25/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/26/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/27/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/28/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/29/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/30/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/31/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "4/1/24": ["Mumbai to Chennai Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n\n Mumbai to Chennai Superfast - Departure: 11:00 AM, Arrival: 10:00 PM"],
- }
- elif from_location.lower() == "amritsar" and to_location.lower() == "mumbai" or from_location.lower() == "mumbai" and to_location.lower() == "amritsar":
- timetable = {
- "3/5/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/6/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/7/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/8/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/9/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/10/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/11/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/12/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/13/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/14/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/15/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/16/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/17/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/18/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/19/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/20/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/21/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/22/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/23/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/24/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/25/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/26/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/27/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/28/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/29/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- "3/30/24": ["Golden temple Express - Departure: 09:00 AM, Arrival: 08:00 PM \n\n\n Mumbai CSMT express - Departure: 11:00 AM, Arrival: 10:00 PM"],
- }
- else:
- # For other destinations or invalid inputs
- return ["No trains found for the given criteria."]
- # Check if there are schedules available for the provided date
- if date in timetable:
- return timetable[date]
- else:
- return ["No trains available on the selected date or incomplete data is provided."]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement