Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions GraphicUser_InterFace/Display_availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
import Modules.FileHandling as File

class Available(customtkinter.CTk):
"""
Class representing the Route Information Page GUI.

Attributes:
textbox: Textbox to display available routes.
combobox: ComboBox to select a specific route.
button: Button to proceed with the selected route.
"""
def __init__(self):
super().__init__()

Expand All @@ -13,11 +21,12 @@ def __init__(self):
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure((0, 1), weight=1)

# Textbox for displaying available routes
self.textbox = customtkinter.CTkTextbox(master=self)
self.textbox.grid(row=0, column=0, columnspan=2, padx=20, pady=(20, 0), sticky="nsew")
self.textbox.configure(font=("Arial", 18))


# Fetching available routes from the file and displaying them
AvailableList = sql.Query_FetchFromFile()
AvailableList.reverse()
list=[]
Expand All @@ -29,13 +38,18 @@ def __init__(self):
list.append("Select")
list.reverse()

# ComboBox for route selection
self.combobox = customtkinter.CTkComboBox(master=self, values=list)
self.combobox.grid(row=1, column=0, padx=20, pady=20, sticky="ew")
# Button to proceed with the selected route
self.button = customtkinter.CTkButton(master=self, command=self.button_callback, text="Proceed")
self.button.grid(row=1, column=1, padx=20, pady=20, sticky="ew")


def button_callback(self):
"""
Callback function for the button to handle the selected route and proceed to the payment page.
"""
selection = self.combobox.get()
File.Handle_Selection(selection)
self.destroy()
Expand All @@ -45,4 +59,4 @@ def button_callback(self):

if __name__ == "__main__":
Available = App()
Available.mainloop()
Available.mainloop()