def get_rooms(Frame): for widget in Frame.winfo_children(): widget.destroy() ligne1 = ['Room Number', 'Size', 'Floor', 'View', 'Type', 'Status'] for i in range(len(ligne1)): Label(Frame, text="" + str(ligne1[i]) + "", width=10, borderwidth=2, font = "Verdana 9", bg="#2894FF", relief="groove").grid(row=1, column=i) resultats = queries.get_from_db('rooms') i = 2 for lig in resultats: txt = str(lig[1]) Label(Frame, text="" + str(lig[1]) + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=0) Label(Frame, text="" + lig[2] + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=1) Label(Frame, text="" + lig[3] + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=2) Label(Frame, text="" + lig[4] + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=3) Label(Frame, text="" + lig[5] + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=4) Label(Frame, text="" + lig[9] + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=5) button= Button(Frame, text="View", command=lambda arg1=txt: r_wind.book_room(arg1), width=10, borderwidth=2, relief="groove", bg="light green") button.grid(row=i, column=6) if str(lig[9]) == "booked": button.config(state=DISABLED) i += 1
def fill_complain(Frame): for widget in Frame.winfo_children(): widget.destroy() ligne1 = ['First Name', 'Last Name','Room Number'] for i in range(len(ligne1)): Label(Frame, text="" + str(ligne1[i]) + "", font = "Verdana 9", bg="#2894FF", width=17, borderwidth=2, relief="groove").grid(row=1, column=i) resultats = queries.get_from_db("clients") i = 2 for lig in resultats: txt = str(lig[15]) Label(Frame, text="" + lig[0] + "", width=17, borderwidth=2, relief="groove").grid(row=i, column=0) Label(Frame, text="" + lig[1] + "", width=17, borderwidth=2, relief="groove").grid(row=i, column=1) Label(Frame, text="" + lig[9] + "", width=17, borderwidth=2, relief="groove").grid(row=i, column=2) Button(Frame, text="Fill A Complain", command=lambda arg1=txt : Add.add_complain(arg1), width=17, borderwidth=2, relief="groove").grid(row=i, column=3) i += 1
def get_clients(Frame): for widget in Frame.winfo_children(): widget.destroy() ligne1 = ['First Name', 'Last Name','Country', 'Email', 'IDcard'] for i in range(len(ligne1)): Label(Frame, text="" + str(ligne1[i]) + "", font = "Verdana 9", bg="#2894FF", width=10, borderwidth=2, relief="groove").grid(row=1, column=i) resultats = queries.get_from_db('clients') i = 2 for lig in resultats: txt = str(lig[15]) Label(Frame, text="" + lig[0] + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=0) Label(Frame, text="" + lig[1] + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=1) Label(Frame, text="" + lig[2] + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=2) Label(Frame, text="" + lig[3] + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=3) Label(Frame, text="" + lig[4] + "", width=10, borderwidth=2, relief="groove").grid(row=i, column=4) Button(Frame, text="View", command=lambda arg1=txt: c_wind.aff_client_info(arg1), width=10, borderwidth=2, relief="groove", bg="light green").grid(row=i, column=5) i += 1
def get_events(Frame): for widget in Frame.winfo_children(): widget.destroy() # create the containers events_frame = LabelFrame(Frame, bg='#99CCFF', text='Hotel Events', width=700, height=50, pady=3, bd=4) events_frame.grid(row=0, sticky="ew") # get events info from database resultats = queries.get_from_db("events") i = 1 for lig in resultats: Label(events_frame, text="Event : " + str(lig[0]) + "", width=100, relief="flat", bg="#99CCFF").grid(row=i, column=0) Label(events_frame, text="Date : " + str(lig[1]) + "", width=100, borderwidth=1, relief="flat", bg="#99CCFF").grid(row=i+1, column=0) Label(events_frame, text="Local : " + str(lig[3]) + "", width=100, borderwidth=1, relief="flat", bg="#99CCFF").grid(row=i+2, column=0) Label(events_frame, text="" + str(lig[2]) + "", width=100, relief="flat", bg="#99CCFF").grid(row=i+3, column=0) Label(events_frame, text="", width=100, borderwidth=0.1, relief="sunken").grid(row=i+4, column=0) i += 5
def get_policy(): root = Tk() root.title('Hotel Policy') root.geometry('{}x{}'.format(918, 570)) # layout all of the main containers root.grid_rowconfigure(1, weight=1) root.grid_columnconfigure(0, weight=1) root.configure(background="#99CCFF") fr = LabelFrame(root, bg='#99CCFF', text='Hotel Policy', width=900, height=700, pady=3, bd=4) fr.grid(row=0, sticky="ew") resultats = queries.get_from_db("policy") i = 0 for lig in resultats: Label(fr, text=str(lig[0]), bg='#2894FF', font="Times", width=100).grid(column=0, row=i, sticky='nw') Label(fr, text=str(lig[1]), bg='#99CCFF', wraplength=777, justify=LEFT).grid(column=0, row=i+2, sticky='nw') i += 4
def get_complains(Frame): for widget in Frame.winfo_children(): widget.destroy() complain_frame = LabelFrame(Frame, bg='#99CCFF', text='Complains', width=700, height=50, pady=3, bd=4) complain_frame.grid(row=0, sticky="ew") # get complains info from database resultats = queries.get_from_db("complains") i = 1 for lig in resultats: client_id = str(lig[0]) #get client namez by id from db res = queries.get_db_cond("clients", "id", client_id) for row in res: lname = str(row[0]) fname = str(row[1]) Label(complain_frame, text="Client Name : " + lname + " " + fname + " ", width=100, relief="flat", bg="#99CCFF", wraplength=320).grid(row=i, column=0) Label(complain_frame, text="Subject : " + str(lig[1]) + "", borderwidth=1, relief="flat", bg="#99CCFF", wraplength=444, justify=LEFT).grid(row=i+1, column=0) Label(complain_frame, text="Description : ", width=15, borderwidth=1, relief="flat", bg="#99CCFF").grid(row=i+2, column=0) Label(complain_frame, text="" + str(lig[2]) + "", width=100, relief="flat", bg="#99CCFF", wraplength=444, justify=LEFT).grid(row=i+3, column=0) Label(complain_frame, text="", width=100, relief="sunken").grid(row=i+4, column=0) i += 5