class SearchWindow: def __init__(self): self.db_conn = DBInteraction() self.root = Tk() self.root.wm_title("Search Database") self.root.geometry("650x400") self.search_label = Label(self.root, font="Georgia 14 bold", text="Search:") self.search_label.pack() self.search_box = Entry(self.root, font="Georgia 14") self.search_box['width'] = 20 self.search_box.pack() self.search_btn = Button(self.root, text="Search", command=self.search_db) self.search_btn.pack() spacer = Label(self.root, text="\n\n", font="Georgia 5") spacer.pack() id_label = Label(self.root, text="ID", font="Georgia 14 bold") id_label.place(x=65, y=80) name_label = Label(self.root, text="Name", font="Georgia 14 bold") name_label.place(x=220, y=80) age_label = Label(self.root, text="Age", font="Georgia 14 bold") age_label.place(x=390, y=80) gender_label = Label(self.root, text="Gender", font="Georgia 14 bold") gender_label.place(x=525, y=80) self.references = [] self.root.mainloop() self.db_conn.shutdown() def search_db(self): # ============== DELETING THE OLD RESULTS ============== for widget in self.references: widget.pack_forget() # ================= GETTING NEW RESULTS ================ name = str(self.search_box.get()) db_results = (self.db_conn.search_data(name)) for i in db_results: temp = Label(self.root, text=str( str(i[0]) + "\t\t" + str(i[1]) + "\t" "\t" + str(i[2]) + "\t\t" + str(i[3]) ), font="Georgia 12" ) temp.pack() self.references.append(temp)
def __init__(self): self.db_conn = DBInteraction() self.root = Tk() self.root.wm_title("Search Database") self.root.geometry("650x400") self.search_label = Label(self.root, font="Georgia 14 bold", text="Search:") self.search_label.pack() self.search_box = Entry(self.root, font="Georgia 14") self.search_box['width'] = 20 self.search_box.pack() self.search_btn = Button(self.root, text="Search", command=self.search_db) self.search_btn.pack() spacer = Label(self.root, text="\n\n", font="Georgia 5") spacer.pack() id_label = Label(self.root, text="ID", font="Georgia 14 bold") id_label.place(x=65, y=80) name_label = Label(self.root, text="Name", font="Georgia 14 bold") name_label.place(x=220, y=80) age_label = Label(self.root, text="Age", font="Georgia 14 bold") age_label.place(x=390, y=80) gender_label = Label(self.root, text="Gender", font="Georgia 14 bold") gender_label.place(x=525, y=80) self.references = [] self.root.mainloop() self.db_conn.shutdown()
from tkinter import * from tkinter import messagebox from PIL import Image, ImageTk from dbInteraction import DBInteraction from searchDB import SearchWindow db = DBInteraction() db.create_tables() f = open('stored_p_id.txt', 'r') stored_p_id = int(f.read()) current_p_id = -1 img_new = None # =================================================================================================== # =================================== MESSAGE BOX FUNCTIONALITIES =================================== # =================================================================================================== def clear_all(): name_box.delete(0.0, END) age_box.delete(0.0, END) gender_box.delete(0.0, END) last_visit_box.delete(0.0, END) allergies_box.delete(0.0, END) diseases_conditions_box.delete(0.0, END) med_history_box.delete(0.0, END) add_comments_box.delete(0.0, END) patient_box.delete(0, END) def enable_all():