def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#78909C' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' font11 = "-family {Segoe UI} -size 20 -weight bold" font9 = "-family {Segoe UI} -size 11" self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.',background=_bgcolor) self.style.configure('.',foreground=_fgcolor) self.style.configure('.',font="TkDefaultFont") self.style.map('.',background= [('selected', _compcolor), ('active',_ana2color)]) top.geometry("1300x760+20+20") top.minsize(800, 500) top.maxsize(1500, 750) top.resizable(0, 0) top.title("Alerts") top.configure(background="#78909C") self.Frame1 = tk.Frame(top) self.Frame1.place(relx=0.0, rely=-0.017, relheight=1.028, relwidth=1.008) self.Frame1.configure(relief='groove') self.Frame1.configure(borderwidth="2") self.Frame1.configure(relief="groove") self.Frame1.configure(background="#78909C") self.Button0 = tk.Button(self.Frame1, command = alerts_support.destroy_window) self.Button0.place(x=10, y=20, height=33, width=56) self.Button0.configure(activebackground="#ececec") self.Button0.configure(activeforeground="#000000") self.Button0.configure(background="#d9d9d9") self.Button0.configure(disabledforeground="#a3a3a3") self.Button0.configure(foreground="#000000") self.Button0.configure(highlightbackground="#d9d9d9") self.Button0.configure(highlightcolor="black") self.Button0.configure(pady="0") self.Button0.configure(text='''< Back''') self.Label1_5 = tk.Label(self.Frame1) self.Label1_5.place(relx=0.41, rely=0.014, height=51, width=193) self.Label1_5.configure(activebackground="#f9f9f9") self.Label1_5.configure(activeforeground="black") self.Label1_5.configure(background="#78909C") self.Label1_5.configure(disabledforeground="#a3a3a3") self.Label1_5.configure(font=font11) self.Label1_5.configure(foreground="#000000") self.Label1_5.configure(highlightbackground="#d9d9d9") self.Label1_5.configure(highlightcolor="black") self.Label1_5.configure(text='''ALERTS''') self.TSeparator1 = ttk.Separator(self.Frame1) self.TSeparator1.place(relx=0.788, rely=0.145, relheight=0.804) self.TSeparator1.configure(orient="vertical") self.Label2 = tk.Label(self.Frame1) self.Label2.place(relx=0.054, rely=0.09, height=41, width=136) self.Label2.configure(background="#78909C") self.Label2.configure(disabledforeground="#a3a3a3") self.Label2.configure(font=font9) self.Label2.configure(foreground="#000000") self.Label2.configure(text='''Anthrax''') self.Label1 = tk.Label(self.Frame1) self.Label1.place(relx=0.203, rely=0.09, height=53, width=234) self.Label1.configure(background="#78909C") self.Label1.configure(disabledforeground="#a3a3a3") self.Label1.configure(font="-family {Segoe UI} -size 10") self.Label1.configure(foreground="#000000") self.Label1.configure(text='''Haemorrhagic Septicemia''') self.Label1_5 = tk.Label(self.Frame1) self.Label1_5.place(relx=0.406, rely=0.09, height=50, width=234) self.Label1_5.configure(background="#78909C") self.Label1_5.configure(disabledforeground="#a3a3a3") self.Label1_5.configure(font=font9) self.Label1_5.configure(foreground="#000000") self.Label1_5.configure(text='''Enterotoxaemia''') self.Label1_5 = tk.Label(self.Frame1) self.Label1_5.place(relx=0.596, rely=0.09, height=50, width=234) self.Label1_5.configure(background="#78909C") self.Label1_5.configure(disabledforeground="#a3a3a3") self.Label1_5.configure(font=font9) self.Label1_5.configure(foreground="#000000") self.Label1_5.configure(text='''Black Quarter''') self.Label1_5 = tk.Label(self.Frame1) self.Label1_5.place(relx=0.02, rely=0.519, height=51, width=234) self.Label1_5.configure(activebackground="#f9f9f9") self.Label1_5.configure(activeforeground="black") self.Label1_5.configure(background="#78909C") self.Label1_5.configure(disabledforeground="#a3a3a3") self.Label1_5.configure(font=font9) self.Label1_5.configure(foreground="#000000") self.Label1_5.configure(highlightbackground="#d9d9d9") self.Label1_5.configure(highlightcolor="black") self.Label1_5.configure(text='''P.P.R''') self.Label1_5 = tk.Label(self.Frame1) self.Label1_5.place(relx=0.203, rely=0.519, height=51, width=234) self.Label1_5.configure(activebackground="#f9f9f9") self.Label1_5.configure(activeforeground="black") self.Label1_5.configure(background="#78909C") self.Label1_5.configure(disabledforeground="#a3a3a3") self.Label1_5.configure(font=font9) self.Label1_5.configure(foreground="#000000") self.Label1_5.configure(highlightbackground="#d9d9d9") self.Label1_5.configure(highlightcolor="black") self.Label1_5.configure(text='''Foot & mouth disease''') self.Label1_5 = tk.Label(self.Frame1) self.Label1_5.place(relx=0.406, rely=0.519, height=51, width=234) self.Label1_5.configure(activebackground="#f9f9f9") self.Label1_5.configure(activeforeground="black") self.Label1_5.configure(background="#78909C") self.Label1_5.configure(disabledforeground="#a3a3a3") self.Label1_5.configure(font=font9) self.Label1_5.configure(foreground="#000000") self.Label1_5.configure(highlightbackground="#d9d9d9") self.Label1_5.configure(highlightcolor="black") self.Label1_5.configure(text='''Goat Pox''') self.Label1_5 = tk.Label(self.Frame1) self.Label1_5.place(relx=0.596, rely=0.519, height=51, width=234) self.Label1_5.configure(activebackground="#f9f9f9") self.Label1_5.configure(activeforeground="black") self.Label1_5.configure(background="#78909C") self.Label1_5.configure(disabledforeground="#a3a3a3") self.Label1_5.configure(font=font9) self.Label1_5.configure(foreground="#000000") self.Label1_5.configure(highlightbackground="#d9d9d9") self.Label1_5.configure(highlightcolor="black") self.Label1_5.configure(text='''C.C.P.P''') self.Label1_5 = tk.Label(self.Frame1) self.Label1_5.place(relx=0.808, rely=0.09, height=51, width=234) self.Label1_5.configure(activebackground="#f9f9f9") self.Label1_5.configure(activeforeground="black") self.Label1_5.configure(background="#78909C") self.Label1_5.configure(disabledforeground="#a3a3a3") self.Label1_5.configure(font=font9) self.Label1_5.configure(foreground="#000000") self.Label1_5.configure(highlightbackground="#d9d9d9") self.Label1_5.configure(highlightcolor="black") self.Label1_5.configure(text='''DATE OF DELIVERY''') self.Label1_5 = tk.Label(self.Frame1) self.Label1_5.place(relx=0.808, rely=0.519, height=51, width=234) self.Label1_5.configure(activebackground="#f9f9f9") self.Label1_5.configure(activeforeground="black") self.Label1_5.configure(background="#78909C") self.Label1_5.configure(disabledforeground="#a3a3a3") self.Label1_5.configure(font=font9) self.Label1_5.configure(foreground="#000000") self.Label1_5.configure(highlightbackground="#d9d9d9") self.Label1_5.configure(highlightcolor="black") self.Label1_5.configure(text='''BREED READY''') #vacc 1 self.tree1 = ttk.Treeview(self.Frame1) self.tree1["columns"] = ("#0", "#1", "#2") self.tree1.column("#0", width=0) self.tree1.column("#1", width=60, anchor='center') self.tree1.column("#2", width=120, anchor='center') self.tree1.heading("#1", text="GOAT ID") self.tree1.heading("#2", text="NEXT VACCINATION") self.tree1.place(relx=0.035, rely=0.15, relheight=0.376, relwidth=0.157) #vacc 2 self.tree2 = ttk.Treeview(top) self.tree2["columns"] = ("#0", "#1", "#2") self.tree2.column("#0", width=0) self.tree2.column("#1", width=60, anchor='center') self.tree2.column("#2", width=120, anchor='center') self.tree2.heading("#1", text="GOAT ID") self.tree2.heading("#2", text="NEXT VACCINATION") self.tree2.place(relx=0.23, rely=0.14, relheight=0.383, relwidth=0.157) #vacc 3 self.tree3 = ttk.Treeview(top) self.tree3["columns"] = ("#0", "#1", "#2") self.tree3.column("#0", width=0) self.tree3.column("#1", width=60, anchor='center') self.tree3.column("#2", width=120, anchor='center') self.tree3.heading("#1", text="GOAT ID") self.tree3.heading("#2", text="NEXT VACCINATION") self.tree3.place(relx=0.42, rely=0.14, relheight=0.383, relwidth=0.157) #vacc 4 self.tree31 = ttk.Treeview(top) self.tree31["columns"] = ("#0", "#1", "#2") self.tree31.column("#0", width=0) self.tree31.column("#1", width=60, anchor='center') self.tree31.column("#2", width=120, anchor='center') self.tree31.heading("#1", text="GOAT ID") self.tree31.heading("#2", text="NEXT VACCINATION") self.tree31.place(relx=0.61, rely=0.14, relheight=0.384, relwidth=0.157) #vacc 5 self.tree4 = ttk.Treeview(top) self.tree4["columns"] = ("#0", "#1", "#2") self.tree4.column("#0", width=0) self.tree4.column("#1", width=60, anchor='center') self.tree4.column("#2", width=120, anchor='center') self.tree4.heading("#1", text="GOAT ID") self.tree4.heading("#2", text="NEXT VACCINATION") self.tree4.place(relx=0.035, rely=0.573, relheight=0.384, relwidth=0.158) #vacc 6 self.tree5 = ttk.Treeview(top) self.tree5["columns"] = ("#0", "#1", "#2") self.tree5.column("#0", width=0) self.tree5.column("#1", width=60, anchor='center') self.tree5.column("#2", width=120, anchor='center') self.tree5.heading("#1", text="GOAT ID") self.tree5.heading("#2", text="NEXT VACCINATION") self.tree5.place(relx=0.23, rely=0.573, relheight=0.384, relwidth=0.157) #vacc 7 self.tree6 = ttk.Treeview(top) self.tree6["columns"] = ("#0", "#1", "#2") self.tree6.column("#0", width=0) self.tree6.column("#1", width=60, anchor='center') self.tree6.column("#2", width=120, anchor='center') self.tree6.heading("#1", text="GOAT ID") self.tree6.heading("#2", text="NEXT VACCINATION") self.tree6.place(relx=0.42, rely=0.573, relheight=0.384, relwidth=0.157) #vacc 8 self.tree61 = ttk.Treeview(top) self.tree61["columns"] = ("#0", "#1", "#2") self.tree61.column("#0", width=0) self.tree61.column("#1", width=60, anchor='center') self.tree61.column("#2", width=120, anchor='center') self.tree61.heading("#1", text="GOAT ID") self.tree61.heading("#2", text="NEXT VACCINATION") self.tree61.place(relx=0.61, rely=0.573, relheight=0.384, relwidth=0.157) self.tree7 = ttk.Treeview(top) self.tree7["columns"] = ("#0", "#1", "#2") self.tree7.column("#0", width=0) self.tree7.column("#1", width=80, anchor='center') self.tree7.column("#2", width=100, anchor='center') self.tree7.heading("#1", text="MOTHER ID") self.tree7.heading("#2", text="EXPECTED DATE") self.tree7.place(relx=0.820, rely=0.14, relheight=0.383, relwidth=0.157) self.tree8 = ttk.Treeview(top) self.tree8["columns"] = ("#0", "#1", "#2") self.tree8.column("#0", width=0) self.tree8.column("#1", width=90, anchor='center') self.tree8.column("#2", width=90, anchor='center') self.tree8.heading("#1", text="MOTHER ID") self.tree8.heading("#2", text="BREED") self.tree8.place(relx=0.820, rely=0.573, relheight=0.384, relwidth=0.157) self.Button1 = tk.Button(top) self.Button1.place(relx=0.16, rely=0.09, height=30, width=40) self.Button1.configure(activebackground="#ececec") self.Button1.configure(activeforeground="#000000") self.Button1.configure(background="#d9d9d9") self.Button1.configure(disabledforeground="#a3a3a3") self.Button1.configure(font=font9) self.Button1.configure(foreground="#000000") self.Button1.configure(highlightbackground="#d9d9d9") self.Button1.configure(highlightcolor="black") self.Button1.configure(pady="0") self.Button1.configure(text='''Done''') self.Button1.configure(command=lambda: self.setVaccinated(1)) self.Button2 = tk.Button(top) self.Button2.place(relx=0.355, rely=0.09, height=30, width=40) self.Button2.configure(activebackground="#ececec") self.Button2.configure(activeforeground="#000000") self.Button2.configure(background="#d9d9d9") self.Button2.configure(disabledforeground="#a3a3a3") self.Button2.configure(font=font9) self.Button2.configure(foreground="#000000") self.Button2.configure(highlightbackground="#d9d9d9") self.Button2.configure(highlightcolor="black") self.Button2.configure(pady="0") self.Button2.configure(text='''Done''') self.Button2.configure(command=lambda: self.setVaccinated(2)) self.Button3 = tk.Button(top) self.Button3.place(relx=0.545, rely=0.09, height=30, width=40) self.Button3.configure(activebackground="#ececec") self.Button3.configure(activeforeground="#000000") self.Button3.configure(background="#d9d9d9") self.Button3.configure(disabledforeground="#a3a3a3") self.Button3.configure(font=font9) self.Button3.configure(foreground="#000000") self.Button3.configure(highlightbackground="#d9d9d9") self.Button3.configure(highlightcolor="black") self.Button3.configure(pady="0") self.Button3.configure(text='''Done''') self.Button3.configure(command=lambda: self.setVaccinated(3)) self.Button4 = tk.Button(top) self.Button4.place(relx=0.737, rely=0.09, height=30, width=40) self.Button4.configure(activebackground="#ececec") self.Button4.configure(activeforeground="#000000") self.Button4.configure(background="#d9d9d9") self.Button4.configure(disabledforeground="#a3a3a3") self.Button4.configure(font=font9) self.Button4.configure(foreground="#000000") self.Button4.configure(highlightbackground="#d9d9d9") self.Button4.configure(highlightcolor="black") self.Button4.configure(pady="0") self.Button4.configure(text='''Done''') self.Button4.configure(command=lambda: self.setVaccinated(4)) self.Button5 = tk.Button(top) self.Button5.place(relx=0.16, rely=0.53, height=30, width=40) self.Button5.configure(activebackground="#ececec") self.Button5.configure(activeforeground="#000000") self.Button5.configure(background="#d9d9d9") self.Button5.configure(disabledforeground="#a3a3a3") self.Button5.configure(font=font9) self.Button5.configure(foreground="#000000") self.Button5.configure(highlightbackground="#d9d9d9") self.Button5.configure(highlightcolor="black") self.Button5.configure(pady="0") self.Button5.configure(text='''Done''') self.Button5.configure(command=lambda: self.setVaccinated(5)) self.Button6 = tk.Button(top) self.Button6.place(relx=0.355, rely=0.53, height=30, width=40) self.Button6.configure(activebackground="#ececec") self.Button6.configure(activeforeground="#000000") self.Button6.configure(background="#d9d9d9") self.Button6.configure(disabledforeground="#a3a3a3") self.Button6.configure(font=font9) self.Button6.configure(foreground="#000000") self.Button6.configure(highlightbackground="#d9d9d9") self.Button6.configure(highlightcolor="black") self.Button6.configure(pady="0") self.Button6.configure(text='''Done''') self.Button6.configure(command=lambda: self.setVaccinated(6)) self.Button7 = tk.Button(top) self.Button7.place(relx=0.545, rely=0.53, height=30, width=40) self.Button7.configure(activebackground="#ececec") self.Button7.configure(activeforeground="#000000") self.Button7.configure(background="#d9d9d9") self.Button7.configure(disabledforeground="#a3a3a3") self.Button7.configure(font=font9) self.Button7.configure(foreground="#000000") self.Button7.configure(highlightbackground="#d9d9d9") self.Button7.configure(highlightcolor="black") self.Button7.configure(pady="0") self.Button7.configure(text='''Done''') self.Button7.configure(command=lambda: self.setVaccinated(7)) self.Button8 = tk.Button(top) self.Button8.place(relx=0.737, rely=0.53, height=30, width=40) self.Button8.configure(activebackground="#ececec") self.Button8.configure(activeforeground="#000000") self.Button8.configure(background="#d9d9d9") self.Button8.configure(disabledforeground="#a3a3a3") self.Button8.configure(font=font9) self.Button8.configure(foreground="#000000") self.Button8.configure(highlightbackground="#d9d9d9") self.Button8.configure(highlightcolor="black") self.Button8.configure(pady="0") self.Button8.configure(text='''Done''') self.Button8.configure(command=lambda: self.setVaccinated(8)) self.vButton = tk.Button(top) self.vButton.place(relx=0.837, rely=0.001, height=50, width=170) self.vButton.configure(activebackground="#ececec") self.vButton.configure(activeforeground="#000000") self.vButton.configure(background="#d9d9d9") self.vButton.configure(disabledforeground="#a3a3a3") self.vButton.configure(font=font9) self.vButton.configure(foreground="#000000") self.vButton.configure(highlightbackground="#d9d9d9") self.vButton.configure(highlightcolor="black") self.vButton.configure(pady="0") self.vButton.configure(text='''Vaccination Reference''') self.vButton.configure(command = lambda: vaccination.create_Toplevel1(root)) self.db = DataBase() self.v1data = self.db.getGoatsToBeVaccinated(1) self.v2data = self.db.getGoatsToBeVaccinated(2) self.v3data = self.db.getGoatsToBeVaccinated(3) self.v4data = self.db.getGoatsToBeVaccinated(4) self.v5data = self.db.getGoatsToBeVaccinated(5) self.v6data = self.db.getGoatsToBeVaccinated(6) self.v7data = self.db.getGoatsToBeVaccinated(7) self.v8data = self.db.getGoatsToBeVaccinated(8) self.deliveryDates = self.db.getDeliveryDates() self.breedReadyGoats = self.db.getBreedReadyGoats() if self.v1data != None: for i in range(len(self.v1data)): self.tree1.insert("", END, text="", values=self.v1data[i]) if self.v2data != None: for i in range(len(self.v2data)): self.tree2.insert("", END, text="", values=self.v2data[i]) if self.v3data != None: for i in range(len(self.v3data)): self.tree3.insert("", END, text="", values=self.v3data[i]) if self.v4data != None: for i in range(len(self.v4data)): self.tree31.insert("", END, text="", values=self.v4data[i]) if self.v5data != None: for i in range(len(self.v5data)): self.tree4.insert("", END, text="", values=self.v5data[i]) if self.v6data != None: for i in range(len(self.v6data)): self.tree5.insert("", END, text="", values=self.v6data[i]) if self.v7data != None: for i in range(len(self.v7data)): self.tree6.insert("", END, text="", values=self.v7data[i]) if self.v8data != None: for i in range(len(self.v8data)): self.tree61.insert("", END, text="", values=self.v8data[i]) if self.deliveryDates != None: for i in range(len(self.deliveryDates)): self.tree7.insert("", END, text="", values=self.deliveryDates[i]) if self.breedReadyGoats != None: for i in range(len(self.breedReadyGoats)): self.tree8.insert("", END, text="", values=self.breedReadyGoats[i])
def displayMasterChart(): try: from tkinter import Tk import tkMessageBox as messagebox except ImportError: from tkinter import Tk from tkinter import messagebox root = Tk() root.geometry("1500x760+0+0") root.minsize(800, 500) root.maxsize(1800, 850) root.resizable(1, 1) root.title("Master Chart") root.configure(background="#f3f3f3") root.configure(highlightbackground="#d9d9d9") root.configure(highlightcolor="#090000") Frame1 = Frame(root) Frame1.place(relx=0.0, rely=0.03, relheight=0.97, relwidth=1.0) Frame1.configure(relief='groove') Frame1.configure(borderwidth="2") Frame1.configure(relief="groove") Frame1.configure(background="#78909C") Frame1.configure(highlightbackground="#d9d9d9") Frame1.configure(highlightcolor="black") def on_select(data): menu.delete(0, 2) row_data = data # print(data) # print("\n") createMenu(row_data) db = DataBase() global menu menu = Menu(root, tearoff=0) def createMenu(row_data): menu.add_command(label="Update", command=lambda: updateGoat.create_Toplevel1(root, row_data)) menu.add_separator() menu.add_command(label="View", command=lambda: view.create_Toplevel1(root, row_data)) mc = Multicolumn_Listbox(Frame1, db.getColumnNames(), stripped_rows = ("white","#f2f2f2"), command=on_select, cell_anchor="center", height=600, adjust_heading_to_content=True) mc.interior.place(relx=0.0,rely=0,relheight= 0.97,relwidth=0.985) vsb = ttk.Scrollbar(Frame1, orient = "horizontal", command = mc.interior.xview) vsb.pack(side = 'bottom', fill= 'x') mc.interior.configure(xscrollcommand = vsb.set) def populateTree(): for record in db.getGoatRecords(): mc.insert_row(record) populateTree() def refreshPage(): mc.clear() populateTree() Button3 = tk.Button(root) Button3.place(relx=0.870, rely=0.00, height=25, width=80) Button3.configure(activebackground="#ececec") Button3.configure(activeforeground="#000000") Button3.configure(background="#d9d9d9") Button3.configure(disabledforeground="#a3a3a3") Button3.configure(font="-family {Segoe UI} -size 14") Button3.configure(foreground="#000000") Button3.configure(highlightbackground="#d9d9d9") Button3.configure(highlightcolor="black") Button3.configure(pady="0") Button3.configure(text='''Refresh''') Button3.configure(command=refreshPage) root.mainloop()
def __init__(self, top=None, goatData=[]): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' font10 = "-family {Segoe UI} -size 9" font9 = "-family {Segoe UI} -size 12 -weight bold" top.geometry("450x690+484+55") top.minsize(120, 1) top.maxsize(1800, 850) top.resizable(0, 0) top.title("Update Goat") top.configure(background="#78909C") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.goatData = goatData self.db = DataBase() # By default self.mortality should be 1 self.mortality = 'Alive' self.pregnant = 'No' self.Frame1 = tk.Frame(top) self.Frame1.place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0) self.Frame1.configure(relief='groove') self.Frame1.configure(borderwidth="2") self.Frame1.configure(relief="groove") self.Frame1.configure(background="#d9d9d9") self.Frame1.configure(highlightbackground="#d9d9d9") self.Frame1.configure(highlightcolor="black") self.Label1 = tk.Label(self.Frame1) self.Label1.place(relx=0.358, rely=0.001, height=29, width=118) self.Label1.configure(activebackground="#f9f9f9") self.Label1.configure(activeforeground="black") self.Label1.configure(background="#d9d9d9") self.Label1.configure(disabledforeground="#a3a3a3") self.Label1.configure(font=font9) self.Label1.configure(foreground="#000000") self.Label1.configure(highlightbackground="#d9d9d9") self.Label1.configure(highlightcolor="black") self.Label1.configure(text='''UPDATE GOAT''') self.Label2 = tk.Label(self.Frame1) self.Label2.place(relx=0.042, rely=0.05, height=21, width=134) self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(activeforeground="black") self.Label2.configure(background="#d9d9d9") self.Label2.configure(disabledforeground="#a3a3a3") self.Label2.configure(foreground="#000000") self.Label2.configure(highlightbackground="#d9d9d9") self.Label2.configure(highlightcolor="black") self.Label2.configure(text='''GOAT ID''') self.Text01 = tk.Entry(self.Frame1) self.Text01.place(relx=0.421, rely=0.05, relheight=0.04, relwidth=0.25) self.Text01.configure(background="white") self.Text01.configure(font="TkTextFont") self.Text01.configure(foreground="black") self.Text01.configure(highlightbackground="#d9d9d9") self.Text01.configure(highlightcolor="black") self.Text01.configure(insertbackground="black") self.Text01.configure(selectbackground="#c4c4c4") self.Text01.configure(selectforeground="black") self.Label2 = tk.Label(self.Frame1) self.Label2.place(relx=0.042, rely=0.1, height=21, width=134) self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(activeforeground="black") self.Label2.configure(background="#d9d9d9") self.Label2.configure(disabledforeground="#a3a3a3") self.Label2.configure(foreground="#000000") self.Label2.configure(highlightbackground="#d9d9d9") self.Label2.configure(highlightcolor="black") self.Label2.configure(text='''BREED''') self.Text02 = tk.Entry(self.Frame1) self.Text02.place(relx=0.421, rely=0.1, relheight=0.04, relwidth=0.25) self.Text02.configure(background="white") self.Text02.configure(font="TkTextFont") self.Text02.configure(foreground="black") self.Text02.configure(highlightbackground="#d9d9d9") self.Text02.configure(highlightcolor="black") self.Text02.configure(insertbackground="black") self.Text02.configure(selectbackground="#c4c4c4") self.Text02.configure(selectforeground="black") self.Label2 = tk.Label(self.Frame1) self.Label2.place(relx=0.042, rely=0.15, height=21, width=134) self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(activeforeground="black") self.Label2.configure(background="#d9d9d9") self.Label2.configure(disabledforeground="#a3a3a3") self.Label2.configure(foreground="#000000") self.Label2.configure(highlightbackground="#d9d9d9") self.Label2.configure(highlightcolor="black") self.Label2.configure(text='''DATE OF BIRTH''') self.Text03 = DateEntry(self.Frame1, width=12, year=2020, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.Text03.place(relx=0.421, rely=0.15, relheight=0.04, relwidth=0.25) self.Label2 = tk.Label(self.Frame1) self.Label2.place(relx=0.042, rely=0.2, height=21, width=134) self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(activeforeground="black") self.Label2.configure(background="#d9d9d9") self.Label2.configure(disabledforeground="#a3a3a3") self.Label2.configure(font="-family {Segoe UI} -size 10 -weight bold") self.Label2.configure(foreground="#000000") self.Label2.configure(highlightbackground="#d9d9d9") self.Label2.configure(highlightcolor="black") self.Label2.configure(text='''PREGNANT DETAILS''') self.Label2_1 = tk.Label(self.Frame1) self.Label2_1.place(relx=0.084, rely=0.24, height=21, width=84) self.Label2_1.configure(activebackground="#f9f9f9") self.Label2_1.configure(activeforeground="black") self.Label2_1.configure(background="#d9d9d9") self.Label2_1.configure(disabledforeground="#a3a3a3") self.Label2_1.configure(foreground="#000000") self.Label2_1.configure(highlightbackground="#d9d9d9") self.Label2_1.configure(highlightcolor="black") self.Label2_1.configure(text='''PREGNANT''') self.Label2_2 = tk.Label(self.Frame1) self.Label2_2.place(relx=0.042, rely=0.28, height=21, width=104) self.Label2_2.configure(activebackground="#f9f9f9") self.Label2_2.configure(activeforeground="black") self.Label2_2.configure(background="#d9d9d9") self.Label2_2.configure(disabledforeground="#a3a3a3") self.Label2_2.configure(font="-family {Segoe UI} -size 9 -weight bold") self.Label2_2.configure(foreground="#000000") self.Label2_2.configure(highlightbackground="#d9d9d9") self.Label2_2.configure(highlightcolor="black") self.Label2_2.configure(text='''WEIGHT DETAILS''') self.Label2_1 = tk.Label(self.Frame1) self.Label2_1.place(relx=0.084, rely=0.32, height=31, width=44) self.Label2_1.configure(activebackground="#f9f9f9") self.Label2_1.configure(activeforeground="black") self.Label2_1.configure(background="#d9d9d9") self.Label2_1.configure(disabledforeground="#a3a3a3") self.Label2_1.configure(foreground="#000000") self.Label2_1.configure(highlightbackground="#d9d9d9") self.Label2_1.configure(highlightcolor="black") self.Label2_1.configure(text='''WEIGHT''') self.Text2 = tk.Entry(self.Frame1) self.Text2.place(relx=0.421, rely=0.32, relheight=0.04, relwidth=0.135) self.Text2.configure(background="white") self.Text2.configure(font="TkTextFont") self.Text2.configure(foreground="black") self.Text2.configure(highlightbackground="#d9d9d9") self.Text2.configure(highlightcolor="black") self.Text2.configure(insertbackground="black") self.Text2.configure(selectbackground="#c4c4c4") self.Text2.configure(selectforeground="black") self.Label2_3 = tk.Label(self.Frame1) self.Label2_3.place(relx=0.035, rely=0.37, height=21, width=84) self.Label2_3.configure(activebackground="#f9f9f9") self.Label2_3.configure(activeforeground="black") self.Label2_3.configure(background="#d9d9d9") self.Label2_3.configure(disabledforeground="#a3a3a3") self.Label2_3.configure(font="-family {Segoe UI} -size 9 -weight bold") self.Label2_3.configure(foreground="#000000") self.Label2_3.configure(highlightbackground="#d9d9d9") self.Label2_3.configure(highlightcolor="black") self.Label2_3.configure(text='''MORTALITY''') self.Label2_3 = tk.Label(self.Frame1) self.Label2_3.place(relx=0.047, rely=0.42, height=21, width=34) self.Label2_3.configure(activebackground="#f9f9f9") self.Label2_3.configure(activeforeground="black") self.Label2_3.configure(background="#d9d9d9") self.Label2_3.configure(disabledforeground="#a3a3a3") self.Label2_3.configure(font="-family {Segoe UI} -size 9 -weight bold") self.Label2_3.configure(foreground="#000000") self.Label2_3.configure(highlightbackground="#d9d9d9") self.Label2_3.configure(highlightcolor="black") self.Label2_3.configure(text='''SOLD''') self.Label3 = tk.Label(self.Frame1) self.Label3.place(relx=0.065, rely=0.45, height=21, width=94) self.Label3.place_forget() self.Label3.configure(activebackground="#f9f9f9") self.Label3.configure(activeforeground="black") self.Label3.configure(background="#d9d9d9") self.Label3.configure(disabledforeground="#a3a3a3") self.Label3.configure(font=font10) self.Label3.configure(foreground="#000000") self.Label3.configure(highlightbackground="#d9d9d9") self.Label3.configure(highlightcolor="black") self.Label3.configure(text='''SOLD RATE''') self.Text1 = tk.Entry(self.Frame1) self.Text1.place(relx=0.421, rely=0.45, relheight=0.04, relwidth=0.25) self.Text1.place_forget() self.Text1.configure(background="white") self.Text1.configure(font="TkTextFont") self.Text1.configure(foreground="black") self.Text1.configure(highlightbackground="#d9d9d9") self.Text1.configure(highlightcolor="black") self.Text1.configure(insertbackground="black") self.Text1.configure(selectbackground="#c4c4c4") self.Text1.configure(selectforeground="black") self.Label0 = tk.Label(self.Frame1) self.Label0.place(relx=0.046, rely=0.52, height=21, width=94) self.Label0.configure(activebackground="#f9f9f9") self.Label0.configure(activeforeground="black") self.Label0.configure(background="#d9d9d9") self.Label0.configure(disabledforeground="#a3a3a3") self.Label0.configure(font="-family {Segoe UI} -size 9 -weight bold") self.Label0.configure(foreground="#000000") self.Label0.configure(highlightbackground="#d9d9d9") self.Label0.configure(highlightcolor="black") self.Label0.configure(text='''VACCINATION''') self.Label4 = tk.Label(self.Frame1) self.Label4.place(relx=0.15, rely=0.55, height=21, width=180) self.Label4.configure(activebackground="#f9f9f9") self.Label4.configure(activeforeground="black") self.Label4.configure(background="#d9d9d9") self.Label4.configure(disabledforeground="#a3a3a3") self.Label4.configure(foreground="#000000") self.Label4.configure(highlightbackground="#d9d9d9") self.Label4.configure(highlightcolor="black") self.Label4.configure(text='''Anthrax''') self.Label5 = tk.Label(self.Frame1) self.Label5.place(relx=0.15, rely=0.6, height=21, width=180) self.Label5.configure(activebackground="#f9f9f9") self.Label5.configure(activeforeground="black") self.Label5.configure(background="#d9d9d9") self.Label5.configure(disabledforeground="#a3a3a3") self.Label5.configure(foreground="#000000") self.Label5.configure(highlightbackground="#d9d9d9") self.Label5.configure(highlightcolor="black") self.Label5.configure(text='''Haemorrhagic Septicemia(H.S)''') self.Label6 = tk.Label(self.Frame1) self.Label6.place(relx=0.15, rely=0.65, height=21, width=180) self.Label6.configure(activebackground="#f9f9f9") self.Label6.configure(activeforeground="black") self.Label6.configure(background="#d9d9d9") self.Label6.configure(disabledforeground="#a3a3a3") self.Label6.configure(foreground="#000000") self.Label6.configure(highlightbackground="#d9d9d9") self.Label6.configure(highlightcolor="black") self.Label6.configure(text='''Enterotoxaemia''') self.Label7 = tk.Label(self.Frame1) self.Label7.place(relx=0.18, rely=0.7, height=21, width=180) self.Label7.configure(activebackground="#f9f9f9") self.Label7.configure(activeforeground="black") self.Label7.configure(background="#d9d9d9") self.Label7.configure(disabledforeground="#a3a3a3") self.Label7.configure(foreground="#000000") self.Label7.configure(highlightbackground="#d9d9d9") self.Label7.configure(highlightcolor="black") self.Label7.configure(text='''Black Quarter''') self.Label8 = tk.Label(self.Frame1) self.Label8.place(relx=0.15, rely=0.75, height=21, width=180) self.Label8.configure(activebackground="#f9f9f9") self.Label8.configure(activeforeground="black") self.Label8.configure(background="#d9d9d9") self.Label8.configure(disabledforeground="#a3a3a3") self.Label8.configure(foreground="#000000") self.Label8.configure(highlightbackground="#d9d9d9") self.Label8.configure(highlightcolor="black") self.Label8.configure(text='''P.P.R.''') self.Label9 = tk.Label(self.Frame1) self.Label9.place(relx=0.15, rely=0.8, height=21, width=180) self.Label9.configure(activebackground="#f9f9f9") self.Label9.configure(activeforeground="black") self.Label9.configure(background="#d9d9d9") self.Label9.configure(disabledforeground="#a3a3a3") self.Label9.configure(foreground="#000000") self.Label9.configure(highlightbackground="#d9d9d9") self.Label9.configure(highlightcolor="black") self.Label9.configure(text='''Foot & mouth disease''') self.Label10 = tk.Label(self.Frame1) self.Label10.place(relx=0.15, rely=0.85, height=21, width=180) self.Label10.configure(activebackground="#f9f9f9") self.Label10.configure(activeforeground="black") self.Label10.configure(background="#d9d9d9") self.Label10.configure(disabledforeground="#a3a3a3") self.Label10.configure(foreground="#000000") self.Label10.configure(highlightbackground="#d9d9d9") self.Label10.configure(highlightcolor="black") self.Label10.configure(text='''Goat Pox''') self.Label11 = tk.Label(self.Frame1) self.Label11.place(relx=0.15, rely=0.9, height=21, width=180) self.Label11.configure(activebackground="#f9f9f9") self.Label11.configure(activeforeground="black") self.Label11.configure(background="#d9d9d9") self.Label11.configure(disabledforeground="#a3a3a3") self.Label11.configure(foreground="#000000") self.Label11.configure(highlightbackground="#d9d9d9") self.Label11.configure(highlightcolor="black") self.Label11.configure(text='''C.C.P.P''') self.Button1 = tk.Button(self.Frame1, command=lambda: self.vaccinated(1)) self.Button1.place(relx=0.55, rely=0.55, height=24, width=140) self.Button1.configure(activebackground="#ececec") self.Button1.configure(activeforeground="#000000") self.Button1.configure(background="#d9d9d9") self.Button1.configure(disabledforeground="#a3a3a3") self.Button1.configure(foreground="#000000") self.Button1.configure(highlightbackground="#d9d9d9") self.Button1.configure(highlightcolor="black") self.Button1.configure(pady="0") self.Button1.configure(text='''REMOVE VACCINATION''') self.Button2 = tk.Button(self.Frame1, command=lambda: self.vaccinated(2)) self.Button2.place(relx=0.55, rely=0.6, height=24, width=140) self.Button2.configure(activebackground="#ececec") self.Button2.configure(activeforeground="#000000") self.Button2.configure(background="#d9d9d9") self.Button2.configure(disabledforeground="#a3a3a3") self.Button2.configure(foreground="#000000") self.Button2.configure(highlightbackground="#d9d9d9") self.Button2.configure(highlightcolor="black") self.Button2.configure(pady="0") self.Button2.configure(text='''REMOVE VACCINATION''') self.Button3 = tk.Button(self.Frame1, command=lambda: self.vaccinated(3)) self.Button3.place(relx=0.55, rely=0.65, height=24, width=140) self.Button3.configure(activebackground="#ececec") self.Button3.configure(activeforeground="#000000") self.Button3.configure(background="#d9d9d9") self.Button3.configure(disabledforeground="#a3a3a3") self.Button3.configure(foreground="#000000") self.Button3.configure(highlightbackground="#d9d9d9") self.Button3.configure(highlightcolor="black") self.Button3.configure(pady="0") self.Button3.configure(text='''REMOVE VACCINATION''') self.Button4 = tk.Button(self.Frame1, command=lambda: self.vaccinated(4)) self.Button4.place(relx=0.55, rely=0.7, height=24, width=140) self.Button4.configure(activebackground="#ececec") self.Button4.configure(activeforeground="#000000") self.Button4.configure(background="#d9d9d9") self.Button4.configure(disabledforeground="#a3a3a3") self.Button4.configure(foreground="#000000") self.Button4.configure(highlightbackground="#d9d9d9") self.Button4.configure(highlightcolor="black") self.Button4.configure(pady="0") self.Button4.configure(text='''REMOVE VACCINATION''') self.Button5 = tk.Button(self.Frame1, command=lambda: self.vaccinated(5)) self.Button5.place(relx=0.55, rely=0.75, height=24, width=140) self.Button5.configure(activebackground="#ececec") self.Button5.configure(activeforeground="#000000") self.Button5.configure(background="#d9d9d9") self.Button5.configure(disabledforeground="#a3a3a3") self.Button5.configure(foreground="#000000") self.Button5.configure(highlightbackground="#d9d9d9") self.Button5.configure(highlightcolor="black") self.Button5.configure(pady="0") self.Button5.configure(text='''REMOVE VACCINATION''') self.Button6 = tk.Button(self.Frame1, command=lambda: self.vaccinated(6)) self.Button6.place(relx=0.55, rely=0.8, height=24, width=140) self.Button6.configure(activebackground="#ececec") self.Button6.configure(activeforeground="#000000") self.Button6.configure(background="#d9d9d9") self.Button6.configure(disabledforeground="#a3a3a3") self.Button6.configure(foreground="#000000") self.Button6.configure(highlightbackground="#d9d9d9") self.Button6.configure(highlightcolor="black") self.Button6.configure(pady="0") self.Button6.configure(text='''REMOVE VACCINATION''') self.Button6_1 = tk.Button(self.Frame1, command=lambda: self.vaccinated(7)) self.Button6_1.place(relx=0.55, rely=0.85, height=24, width=140) self.Button6_1.configure(activebackground="#ececec") self.Button6_1.configure(activeforeground="#000000") self.Button6_1.configure(background="#d9d9d9") self.Button6_1.configure(disabledforeground="#a3a3a3") self.Button6_1.configure(foreground="#000000") self.Button6_1.configure(highlightbackground="#d9d9d9") self.Button6_1.configure(highlightcolor="black") self.Button6_1.configure(pady="0") self.Button6_1.configure(text='''REMOVE VACCINATION''') self.Button6_2 = tk.Button(self.Frame1, command=lambda: self.vaccinated(8)) self.Button6_2.place(relx=0.55, rely=0.9, height=24, width=140) self.Button6_2.configure(activebackground="#ececec") self.Button6_2.configure(activeforeground="#000000") self.Button6_2.configure(background="#d9d9d9") self.Button6_2.configure(disabledforeground="#a3a3a3") self.Button6_2.configure(foreground="#000000") self.Button6_2.configure(highlightbackground="#d9d9d9") self.Button6_2.configure(highlightcolor="black") self.Button6_2.configure(pady="0") self.Button6_2.configure(text='''REMOVE VACCINATION''') self.Button7 = tk.Button(self.Frame1, command=destroy_Toplevel1) self.Button7.place(relx=0.232, rely=0.95, height=24, width=56) self.Button7.configure(activebackground="#ececec") self.Button7.configure(activeforeground="#000000") self.Button7.configure(background="#d9d9d9") self.Button7.configure(disabledforeground="#a3a3a3") self.Button7.configure(foreground="#000000") self.Button7.configure(highlightbackground="#d9d9d9") self.Button7.configure(highlightcolor="black") self.Button7.configure(pady="0") self.Button7.configure(text='''CANCEL''') self.Button8 = tk.Button(self.Frame1, command=self.submitData) self.Button8.place(relx=0.604, rely=0.95, height=24, width=56) self.Button8.configure(activebackground="#ececec") self.Button8.configure(activeforeground="#000000") self.Button8.configure(background="#d9d9d9") self.Button8.configure(disabledforeground="#a3a3a3") self.Button8.configure(foreground="#000000") self.Button8.configure(highlightbackground="#d9d9d9") self.Button8.configure(highlightcolor="black") self.Button8.configure(pady="0") self.Button8.configure(text='''SAVE''') self.isPregnant = IntVar() self.Radiobutton1 = tk.Radiobutton( self.Frame1, command=lambda: self.setPregnancy(1)) self.Radiobutton1.place(relx=0.421, rely=0.24, relheight=0.041, relwidth=0.099) self.Radiobutton1.configure(activebackground="#ececec") self.Radiobutton1.configure(activeforeground="#000000") self.Radiobutton1.configure(background="#d9d9d9") self.Radiobutton1.configure(disabledforeground="#a3a3a3") self.Radiobutton1.configure(foreground="#000000") self.Radiobutton1.configure(highlightbackground="#d9d9d9") self.Radiobutton1.configure(highlightcolor="black") self.Radiobutton1.configure(justify='left') self.Radiobutton1.configure(text='''YES''') self.Radiobutton1.configure(value=1) self.Radiobutton1.configure(variable=self.isPregnant) self.Radiobutton2 = tk.Radiobutton( self.Frame1, command=lambda: self.setPregnancy(0)) self.Radiobutton2.place(relx=0.653, rely=0.24, relheight=0.041, relwidth=0.122) self.Radiobutton2.configure(activebackground="#ececec") self.Radiobutton2.configure(activeforeground="#000000") self.Radiobutton2.configure(background="#d9d9d9") self.Radiobutton2.configure(disabledforeground="#a3a3a3") self.Radiobutton2.configure(foreground="#000000") self.Radiobutton2.configure(highlightbackground="#d9d9d9") self.Radiobutton2.configure(highlightcolor="black") self.Radiobutton2.configure(justify='left') self.Radiobutton2.configure(text='''NO''') self.Radiobutton2.configure(value=0) self.Radiobutton2.configure(variable=self.isPregnant) self.isAlive = IntVar() self.Radiobutton3 = tk.Radiobutton( self.Frame1, command=lambda: self.setMortality(1)) self.Radiobutton3.place(relx=0.421, rely=0.37, relheight=0.041, relwidth=0.143) self.Radiobutton3.configure(activebackground="#ececec") self.Radiobutton3.configure(activeforeground="#000000") self.Radiobutton3.configure(background="#d9d9d9") self.Radiobutton3.configure(disabledforeground="#a3a3a3") self.Radiobutton3.configure(foreground="#000000") self.Radiobutton3.configure(highlightbackground="#d9d9d9") self.Radiobutton3.configure(highlightcolor="black") self.Radiobutton3.configure(justify='left') self.Radiobutton3.configure(text='''ALIVE''') self.Radiobutton3.configure(value=1) self.Radiobutton3.configure(variable=self.isAlive) self.Radiobutton4 = tk.Radiobutton( self.Frame1, command=lambda: self.setMortality(0)) self.Radiobutton4.place(relx=0.653, rely=0.37, relheight=0.041, relwidth=0.143) self.Radiobutton4.configure(activebackground="#ececec") self.Radiobutton4.configure(activeforeground="#000000") self.Radiobutton4.configure(background="#d9d9d9") self.Radiobutton4.configure(disabledforeground="#a3a3a3") self.Radiobutton4.configure(foreground="#000000") self.Radiobutton4.configure(highlightbackground="#d9d9d9") self.Radiobutton4.configure(highlightcolor="black") self.Radiobutton4.configure(justify='left') self.Radiobutton4.configure(text='''DEAD''') self.Radiobutton4.configure(value=0) self.Radiobutton4.configure(variable=self.isAlive) self.isSold = IntVar() self.Radiobutton5 = tk.Radiobutton( self.Frame1, command=lambda: self.showSoldFrame(self.Label3, self.Text1)) self.Radiobutton5.place(relx=0.421, rely=0.42, relheight=0.041, relwidth=0.122) self.Radiobutton5.configure(activebackground="#ececec") self.Radiobutton5.configure(activeforeground="#000000") self.Radiobutton5.configure(background="#d9d9d9") self.Radiobutton5.configure(disabledforeground="#a3a3a3") self.Radiobutton5.configure(foreground="#000000") self.Radiobutton5.configure(highlightbackground="#d9d9d9") self.Radiobutton5.configure(highlightcolor="black") self.Radiobutton5.configure(justify='left') self.Radiobutton5.configure(text='''YES''') self.Radiobutton5.configure(value=1) self.Radiobutton5.configure(variable=self.isSold) self.Radiobutton6 = tk.Radiobutton( self.Frame1, command=lambda: self.hideSoldFrame(self.Label3, self.Text1)) self.Radiobutton6.place(relx=0.653, rely=0.42, relheight=0.041, relwidth=0.122) self.Radiobutton6.configure(activebackground="#ececec") self.Radiobutton6.configure(activeforeground="#000000") self.Radiobutton6.configure(background="#d9d9d9") self.Radiobutton6.configure(disabledforeground="#a3a3a3") self.Radiobutton6.configure(foreground="#000000") self.Radiobutton6.configure(highlightbackground="#d9d9d9") self.Radiobutton6.configure(highlightcolor="black") self.Radiobutton6.configure(justify='left') self.Radiobutton6.configure(text='''NO''') self.Radiobutton6.configure(value=0) self.Radiobutton6.configure(variable=self.isSold) # Disable the pregnancy radiobuttons if goat is male self.male = self.goatData[3] if self.male == 'm': self.Radiobutton1.config(state=DISABLED) self.Radiobutton2.config(state=DISABLED) else: self.Radiobutton1.config(state=NORMAL) self.Radiobutton2.config(state=NORMAL) self.Radiobutton2.select() # Disable Goat ID entry self.Text01.delete(0, END) self.Text01.insert(END, self.goatData[0]) self.Text01.config(state=DISABLED) # Insert default value for breed self.Text02.delete(0, END) self.Text02.insert(END, self.goatData[1]) # Insert default value for DOB self.Text03.set_date( datetime.strptime(self.goatData[2], '%Y-%m-%d').date())
# importing reqd: import string import random import mysql.connector as sq import sys import datetime from tkinter import * from tkinter import ttk try: import tkinter as tk # to work in both python 2 or in python 3 except ImportError: import Tkinter as tk # importing the backend.py file to utilise the functions. from backend import DataBase, top_Database database = DataBase() person = top_Database() # global vars: global e4, checkbutton # <<<<<<<<<<<<< functions for linking buttons : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # note the functions should be made before calling them in the buttons using command # for viewall button to insert all entries into listbox: # to make available in global space # name = "name" ## Function to get the logged user # def name_holder(global_user_name): # global name
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#40e0d0' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#40e0d0' # X11 color: 'gray85' _ana1color = '#40e0d0' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[ ('selected', _compcolor), ('active', _ana2color)]) self.db = DataBase() top.geometry("1300x760+20+20") top.minsize(800, 500) top.maxsize(1500, 750) top.resizable(0, 0) top.title("New Toplevel") top.configure(background="#78909C") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.Gid_10 = tk.Label(top) self.Gid_10.place(relx=0.427, rely=0.021, height=38, width=209) self.Gid_10.configure(activebackground="#f9f9f9") self.Gid_10.configure(activeforeground="black") self.Gid_10.configure(background="#d9d9d9") self.Gid_10.configure(disabledforeground="#a3a3a3") self.Gid_10.configure(font="-family {Segoe UI} -size 20 -weight bold") self.Gid_10.configure(foreground="#000000") self.Gid_10.configure(highlightbackground="#d9d9d9") self.Gid_10.configure(highlightcolor="black") self.Gid_10.configure(text='''ADD GOAT''') self.isBornOrBought = IntVar(None, 0) self.Rbtnborn = tk.Radiobutton(top, command=self.disableVaccination) self.Rbtnborn.place(relx=0.427, rely=0.095, relheight=0.034, relwidth=0.075) self.Rbtnborn.configure(activebackground="#ececec") self.Rbtnborn.configure(activeforeground="#000000") self.Rbtnborn.configure(background="#d9d9d9") self.Rbtnborn.configure(disabledforeground="#a3a3a3") self.Rbtnborn.configure(foreground="#000000") self.Rbtnborn.configure(highlightbackground="#d9d9d9") self.Rbtnborn.configure(highlightcolor="black") self.Rbtnborn.configure(justify='left') self.Rbtnborn.configure(text='''BORN''') self.Rbtnborn.configure(value=0) self.Rbtnborn.configure(variable=self.isBornOrBought) self.Rbtnbought = tk.Radiobutton(top, command=self.disableMotherId) self.Rbtnbought.place(relx=0.513, rely=0.095, relheight=0.034, relwidth=0.075) self.Rbtnbought.configure(activebackground="#ececec") self.Rbtnbought.configure(activeforeground="#000000") self.Rbtnbought.configure(background="#d9d9d9") self.Rbtnbought.configure(disabledforeground="#a3a3a3") self.Rbtnbought.configure(foreground="#000000") self.Rbtnbought.configure(highlightbackground="#d9d9d9") self.Rbtnbought.configure(highlightcolor="black") self.Rbtnbought.configure(justify='left') self.Rbtnbought.configure(text='''BOUGHT''') self.Rbtnbought.configure(value=1) self.Rbtnbought.configure(variable=self.isBornOrBought) self.gdetails = tk.Label(top) self.gdetails.place(x=130,y=100, height=35, width=130) self.gdetails.configure(activebackground="#f9f9f9") self.gdetails.configure(activeforeground="black") self.gdetails.configure(background="#d9d9d9") self.gdetails.configure(disabledforeground="#a3a3a3") self.gdetails.configure(font="-family {Segoe UI} -size 13") self.gdetails.configure(foreground="#000000") self.gdetails.configure(highlightbackground="#d9d9d9") self.gdetails.configure(highlightcolor="black") self.gdetails.configure(text='''GOAT DETAILS''') self.Gid = tk.Label(top) self.Gid.place(x=80,y=155, height=35, width=98) self.Gid.configure(activebackground="#f9f9f9") self.Gid.configure(activeforeground="black") self.Gid.configure(background="#d9d9d9") self.Gid.configure(disabledforeground="#a3a3a3") self.Gid.configure(foreground="#000000") self.Gid.configure(highlightbackground="#d9d9d9") self.Gid.configure(highlightcolor="black") self.Gid.configure(text='''Goat ID''') self.TEntry1 = ttk.Entry(top) self.TEntry1.place(x=250,y=155, height=35, width=140) self.TEntry1.configure(takefocus="") self.breed = tk.Label(top) self.breed.place(x=80,y=200, height=35, width=98) self.breed.configure(activebackground="#f9f9f9") self.breed.configure(activeforeground="black") self.breed.configure(background="#d9d9d9") self.breed.configure(disabledforeground="#a3a3a3") self.breed.configure(foreground="#000000") self.breed.configure(highlightbackground="#d9d9d9") self.breed.configure(highlightcolor="black") self.breed.configure(text='''Breed''') self.TEntry1_22 = ttk.Entry(top) self.TEntry1_22.place(x=250,y=200,height=35, width=140) self.TEntry1_22.configure(takefocus="") self.DOB = tk.Label(top) self.DOB.place(x=80,y=245, height=35, width=98) self.DOB.configure(activebackground="#f9f9f9") self.DOB.configure(activeforeground="black") self.DOB.configure(background="#d9d9d9") self.DOB.configure(disabledforeground="#a3a3a3") self.DOB.configure(foreground="#000000") self.DOB.configure(highlightbackground="#d9d9d9") self.DOB.configure(highlightcolor="black") self.DOB.configure(text='''DOB''') self.goatDob = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.goatDob.place(x=250,y=245, height=35, width=140) self.mother_id = tk.Label(top) self.mother_id.place(x=80,y=290, height=35, width=98) self.mother_id.configure(activebackground="#f9f9f9") self.mother_id.configure(activeforeground="black") self.mother_id.configure(background="#d9d9d9") self.mother_id.configure(disabledforeground="#a3a3a3") self.mother_id.configure(foreground="#000000") self.mother_id.configure(highlightbackground="#d9d9d9") self.mother_id.configure(highlightcolor="black") self.mother_id.configure(text='''Mother ID''') self.TEntry1_24 = ttk.Entry(top) self.TEntry1_24.place(x=250,y=335,height=35, width=140) self.TEntry1_24.configure(takefocus="") self.weight = tk.Label(top) self.weight.place(x=80,y=335, height=35, width=98) self.weight.configure(activebackground="#f9f9f9") self.weight.configure(activeforeground="black") self.weight.configure(background="#d9d9d9") self.weight.configure(disabledforeground="#a3a3a3") self.weight.configure(foreground="#000000") self.weight.configure(highlightbackground="#d9d9d9") self.weight.configure(highlightcolor="black") self.weight.configure(text='''Weight''') self.TEntry1_25 = ttk.Entry(top) self.TEntry1_25.place(x=250,y=290,height=35, width=140) self.TEntry1_25.configure(takefocus="") self.gender = tk.Label(top) self.gender.place(x=80,y=395, height=40, width=98) self.gender.configure(activebackground="#f9f9f9") self.gender.configure(activeforeground="black") self.gender.configure(background="#d9d9d9") self.gender.configure(disabledforeground="#a3a3a3") self.gender.configure(foreground="#000000") self.gender.configure(highlightbackground="#d9d9d9") self.gender.configure(highlightcolor="black") self.gender.configure(text='''Gender''') self.genderVal = IntVar() self.RbtnMale = tk.Radiobutton(top) self.RbtnMale.place(x=250,y=380,height=30,width=80) self.RbtnMale.configure(activebackground="#ececec") self.RbtnMale.configure(activeforeground="#000000") self.RbtnMale.configure(background="#d9d9d9") self.RbtnMale.configure(disabledforeground="#a3a3a3") self.RbtnMale.configure(foreground="#000000") self.RbtnMale.configure(highlightbackground="#d9d9d9") self.RbtnMale.configure(highlightcolor="black") self.RbtnMale.configure(justify='left') self.RbtnMale.configure(text='''MALE''') self.RbtnMale.configure(value=0) self.RbtnMale.configure(variable=self.genderVal) self.RbtnFemale = tk.Radiobutton(top) self.RbtnFemale.place(x=250,y=420,height=30,width=80) self.RbtnFemale.configure(activebackground="#ececec") self.RbtnFemale.configure(activeforeground="#000000") self.RbtnFemale.configure(background="#d9d9d9") self.RbtnFemale.configure(disabledforeground="#a3a3a3") self.RbtnFemale.configure(foreground="#000000") self.RbtnFemale.configure(highlightbackground="#d9d9d9") self.RbtnFemale.configure(highlightcolor="black") self.RbtnFemale.configure(justify='left') self.RbtnFemale.configure(text='''FEMALE''') self.RbtnFemale.configure(value=1) self.RbtnFemale.configure(variable=self.genderVal) self.health = tk.Label(top) self.health.place(x=890,y=100, height=35, width=150) self.health.configure(activebackground="#f9f9f9") self.health.configure(activeforeground="black") self.health.configure(background="#d9d9d9") self.health.configure(disabledforeground="#a3a3a3") self.health.configure(font="-family {Segoe UI} -size 12") self.health.configure(foreground="#000000") self.health.configure(highlightbackground="#d9d9d9") self.health.configure(highlightcolor="black") self.health.configure(text='''LAST VACCINATED''') self.v1 = tk.Label(top) self.v1.place(x=800,y=155, height=35, width=98) self.v1.configure(activebackground="#f9f9f9") self.v1.configure(activeforeground="black") self.v1.configure(background="#d9d9d9") self.v1.configure(disabledforeground="#a3a3a3") self.v1.configure(foreground="#000000") self.v1.configure(highlightbackground="#d9d9d9") self.v1.configure(highlightcolor="black") self.v1.configure(text='''V1''') self.cal1 = DateEntry(top, width=12, year=2020, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal1.place(x=1000,y=155, height=35, width=98) self.v2 = tk.Label(top) self.v2.place(x=800,y=200, height=35, width=98) self.v2.configure(activebackground="#f9f9f9") self.v2.configure(activeforeground="black") self.v2.configure(background="#d9d9d9") self.v2.configure(disabledforeground="#a3a3a3") self.v2.configure(foreground="#000000") self.v2.configure(highlightbackground="#d9d9d9") self.v2.configure(highlightcolor="black") self.v2.configure(text='''V2''') self.cal2 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal2.place(x=1000,y=200, height=35, width=98) self.v3 = tk.Label(top) self.v3.place(x=800,y=245, height=35, width=98) self.v3.configure(activebackground="#f9f9f9") self.v3.configure(activeforeground="black") self.v3.configure(background="#d9d9d9") self.v3.configure(disabledforeground="#a3a3a3") self.v3.configure(foreground="#000000") self.v3.configure(highlightbackground="#d9d9d9") self.v3.configure(highlightcolor="black") self.v3.configure(text='''V3''') self.cal3 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal3.place(x=1000,y=245, height=35, width=98) self.v4 = tk.Label(top) self.v4.place(x=800,y=290, height=35, width=98) self.v4.configure(activebackground="#f9f9f9") self.v4.configure(activeforeground="black") self.v4.configure(background="#d9d9d9") self.v4.configure(disabledforeground="#a3a3a3") self.v4.configure(foreground="#000000") self.v4.configure(highlightbackground="#d9d9d9") self.v4.configure(highlightcolor="black") self.v4.configure(text='''V4''') self.cal4 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal4.place(x=1000,y=290, height=35, width=98) self.v5 = tk.Label(top) self.v5.place(x=800,y=335, height=35, width=98) self.v5.configure(activebackground="#f9f9f9") self.v5.configure(activeforeground="black") self.v5.configure(background="#d9d9d9") self.v5.configure(disabledforeground="#a3a3a3") self.v5.configure(foreground="#000000") self.v5.configure(highlightbackground="#d9d9d9") self.v5.configure(highlightcolor="black") self.v5.configure(text='''V5''') self.cal5 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal5.place(x=1000,y=335, height=35, width=98) self.v6 = tk.Label(top) self.v6.place(x=800,y=380, height=35, width=98) self.v6.configure(activebackground="#f9f9f9") self.v6.configure(activeforeground="black") self.v6.configure(background="#d9d9d9") self.v6.configure(disabledforeground="#a3a3a3") self.v6.configure(foreground="#000000") self.v6.configure(highlightbackground="#d9d9d9") self.v6.configure(highlightcolor="black") self.v6.configure(text='''V6''') self.cal6 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal6.place(x=1000,y=380, height=35, width=98) self.v7 = tk.Label(top) self.v7.place(x=800,y=425, height=35, width=98) self.v7.configure(activebackground="#f9f9f9") self.v7.configure(activeforeground="black") self.v7.configure(background="#d9d9d9") self.v7.configure(disabledforeground="#a3a3a3") self.v7.configure(foreground="#000000") self.v7.configure(highlightbackground="#d9d9d9") self.v7.configure(highlightcolor="black") self.v7.configure(text='''V7''') self.cal7 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal7.place(x=1000,y=425, height=35, width=98) self.v8 = tk.Label(top) self.v8.place(x=800,y=470, height=35, width=98) self.v8.configure(activebackground="#f9f9f9") self.v8.configure(activeforeground="black") self.v8.configure(background="#d9d9d9") self.v8.configure(disabledforeground="#a3a3a3") self.v8.configure(foreground="#000000") self.v8.configure(highlightbackground="#d9d9d9") self.v8.configure(highlightcolor="black") self.v8.configure(text='''V8''') self.cal8 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal8.place(x=1000,y=470, height=35, width=98) self.Submit = tk.Button(top, command=self.acceptValues) self.Submit.place(relx=0.550, rely=0.842, height=30, width=59) self.Submit.configure(activebackground="#ececec") self.Submit.configure(activeforeground="#000000") self.Submit.configure(background="#d9d9d9") self.Submit.configure(disabledforeground="#a3a3a3") self.Submit.configure(foreground="#000000") self.Submit.configure(highlightbackground="#d9d9d9") self.Submit.configure(highlightcolor="black") self.Submit.configure(pady="0") self.Submit.configure(text='''SUBMIT''') self.Cancel = tk.Button(top, command=lambda: addGoat_support.destroy_window()) self.Cancel.place(relx=0.430, rely=0.842, height=30, width=59) self.Cancel.configure(activebackground="#ececec") self.Cancel.configure(activeforeground="#000000") self.Cancel.configure(background="#d9d9d9") self.Cancel.configure(disabledforeground="#a3a3a3") self.Cancel.configure(foreground="#000000") self.Cancel.configure(highlightbackground="#d9d9d9") self.Cancel.configure(highlightcolor="black") self.Cancel.configure(pady="0") self.Cancel.configure(text='''CANCEL''') self.goatDob.set_date(datetime.date(datetime.now())) self.cal1.set_date(datetime.date(datetime.now())) self.cal2.set_date(datetime.date(datetime.now())) self.cal3.set_date(datetime.date(datetime.now())) self.cal4.set_date(datetime.date(datetime.now())) self.cal5.set_date(datetime.date(datetime.now())) self.cal6.set_date(datetime.date(datetime.now())) self.cal7.set_date(datetime.date(datetime.now())) self.cal8.set_date(datetime.date(datetime.now())) self.disableVaccination()
class Toplevel1: def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#40e0d0' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#40e0d0' # X11 color: 'gray85' _ana1color = '#40e0d0' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[ ('selected', _compcolor), ('active', _ana2color)]) self.db = DataBase() top.geometry("1300x760+20+20") top.minsize(800, 500) top.maxsize(1500, 750) top.resizable(0, 0) top.title("New Toplevel") top.configure(background="#78909C") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.Gid_10 = tk.Label(top) self.Gid_10.place(relx=0.427, rely=0.021, height=38, width=209) self.Gid_10.configure(activebackground="#f9f9f9") self.Gid_10.configure(activeforeground="black") self.Gid_10.configure(background="#d9d9d9") self.Gid_10.configure(disabledforeground="#a3a3a3") self.Gid_10.configure(font="-family {Segoe UI} -size 20 -weight bold") self.Gid_10.configure(foreground="#000000") self.Gid_10.configure(highlightbackground="#d9d9d9") self.Gid_10.configure(highlightcolor="black") self.Gid_10.configure(text='''ADD GOAT''') self.isBornOrBought = IntVar(None, 0) self.Rbtnborn = tk.Radiobutton(top, command=self.disableVaccination) self.Rbtnborn.place(relx=0.427, rely=0.095, relheight=0.034, relwidth=0.075) self.Rbtnborn.configure(activebackground="#ececec") self.Rbtnborn.configure(activeforeground="#000000") self.Rbtnborn.configure(background="#d9d9d9") self.Rbtnborn.configure(disabledforeground="#a3a3a3") self.Rbtnborn.configure(foreground="#000000") self.Rbtnborn.configure(highlightbackground="#d9d9d9") self.Rbtnborn.configure(highlightcolor="black") self.Rbtnborn.configure(justify='left') self.Rbtnborn.configure(text='''BORN''') self.Rbtnborn.configure(value=0) self.Rbtnborn.configure(variable=self.isBornOrBought) self.Rbtnbought = tk.Radiobutton(top, command=self.disableMotherId) self.Rbtnbought.place(relx=0.513, rely=0.095, relheight=0.034, relwidth=0.075) self.Rbtnbought.configure(activebackground="#ececec") self.Rbtnbought.configure(activeforeground="#000000") self.Rbtnbought.configure(background="#d9d9d9") self.Rbtnbought.configure(disabledforeground="#a3a3a3") self.Rbtnbought.configure(foreground="#000000") self.Rbtnbought.configure(highlightbackground="#d9d9d9") self.Rbtnbought.configure(highlightcolor="black") self.Rbtnbought.configure(justify='left') self.Rbtnbought.configure(text='''BOUGHT''') self.Rbtnbought.configure(value=1) self.Rbtnbought.configure(variable=self.isBornOrBought) self.gdetails = tk.Label(top) self.gdetails.place(x=130,y=100, height=35, width=130) self.gdetails.configure(activebackground="#f9f9f9") self.gdetails.configure(activeforeground="black") self.gdetails.configure(background="#d9d9d9") self.gdetails.configure(disabledforeground="#a3a3a3") self.gdetails.configure(font="-family {Segoe UI} -size 13") self.gdetails.configure(foreground="#000000") self.gdetails.configure(highlightbackground="#d9d9d9") self.gdetails.configure(highlightcolor="black") self.gdetails.configure(text='''GOAT DETAILS''') self.Gid = tk.Label(top) self.Gid.place(x=80,y=155, height=35, width=98) self.Gid.configure(activebackground="#f9f9f9") self.Gid.configure(activeforeground="black") self.Gid.configure(background="#d9d9d9") self.Gid.configure(disabledforeground="#a3a3a3") self.Gid.configure(foreground="#000000") self.Gid.configure(highlightbackground="#d9d9d9") self.Gid.configure(highlightcolor="black") self.Gid.configure(text='''Goat ID''') self.TEntry1 = ttk.Entry(top) self.TEntry1.place(x=250,y=155, height=35, width=140) self.TEntry1.configure(takefocus="") self.breed = tk.Label(top) self.breed.place(x=80,y=200, height=35, width=98) self.breed.configure(activebackground="#f9f9f9") self.breed.configure(activeforeground="black") self.breed.configure(background="#d9d9d9") self.breed.configure(disabledforeground="#a3a3a3") self.breed.configure(foreground="#000000") self.breed.configure(highlightbackground="#d9d9d9") self.breed.configure(highlightcolor="black") self.breed.configure(text='''Breed''') self.TEntry1_22 = ttk.Entry(top) self.TEntry1_22.place(x=250,y=200,height=35, width=140) self.TEntry1_22.configure(takefocus="") self.DOB = tk.Label(top) self.DOB.place(x=80,y=245, height=35, width=98) self.DOB.configure(activebackground="#f9f9f9") self.DOB.configure(activeforeground="black") self.DOB.configure(background="#d9d9d9") self.DOB.configure(disabledforeground="#a3a3a3") self.DOB.configure(foreground="#000000") self.DOB.configure(highlightbackground="#d9d9d9") self.DOB.configure(highlightcolor="black") self.DOB.configure(text='''DOB''') self.goatDob = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.goatDob.place(x=250,y=245, height=35, width=140) self.mother_id = tk.Label(top) self.mother_id.place(x=80,y=290, height=35, width=98) self.mother_id.configure(activebackground="#f9f9f9") self.mother_id.configure(activeforeground="black") self.mother_id.configure(background="#d9d9d9") self.mother_id.configure(disabledforeground="#a3a3a3") self.mother_id.configure(foreground="#000000") self.mother_id.configure(highlightbackground="#d9d9d9") self.mother_id.configure(highlightcolor="black") self.mother_id.configure(text='''Mother ID''') self.TEntry1_24 = ttk.Entry(top) self.TEntry1_24.place(x=250,y=335,height=35, width=140) self.TEntry1_24.configure(takefocus="") self.weight = tk.Label(top) self.weight.place(x=80,y=335, height=35, width=98) self.weight.configure(activebackground="#f9f9f9") self.weight.configure(activeforeground="black") self.weight.configure(background="#d9d9d9") self.weight.configure(disabledforeground="#a3a3a3") self.weight.configure(foreground="#000000") self.weight.configure(highlightbackground="#d9d9d9") self.weight.configure(highlightcolor="black") self.weight.configure(text='''Weight''') self.TEntry1_25 = ttk.Entry(top) self.TEntry1_25.place(x=250,y=290,height=35, width=140) self.TEntry1_25.configure(takefocus="") self.gender = tk.Label(top) self.gender.place(x=80,y=395, height=40, width=98) self.gender.configure(activebackground="#f9f9f9") self.gender.configure(activeforeground="black") self.gender.configure(background="#d9d9d9") self.gender.configure(disabledforeground="#a3a3a3") self.gender.configure(foreground="#000000") self.gender.configure(highlightbackground="#d9d9d9") self.gender.configure(highlightcolor="black") self.gender.configure(text='''Gender''') self.genderVal = IntVar() self.RbtnMale = tk.Radiobutton(top) self.RbtnMale.place(x=250,y=380,height=30,width=80) self.RbtnMale.configure(activebackground="#ececec") self.RbtnMale.configure(activeforeground="#000000") self.RbtnMale.configure(background="#d9d9d9") self.RbtnMale.configure(disabledforeground="#a3a3a3") self.RbtnMale.configure(foreground="#000000") self.RbtnMale.configure(highlightbackground="#d9d9d9") self.RbtnMale.configure(highlightcolor="black") self.RbtnMale.configure(justify='left') self.RbtnMale.configure(text='''MALE''') self.RbtnMale.configure(value=0) self.RbtnMale.configure(variable=self.genderVal) self.RbtnFemale = tk.Radiobutton(top) self.RbtnFemale.place(x=250,y=420,height=30,width=80) self.RbtnFemale.configure(activebackground="#ececec") self.RbtnFemale.configure(activeforeground="#000000") self.RbtnFemale.configure(background="#d9d9d9") self.RbtnFemale.configure(disabledforeground="#a3a3a3") self.RbtnFemale.configure(foreground="#000000") self.RbtnFemale.configure(highlightbackground="#d9d9d9") self.RbtnFemale.configure(highlightcolor="black") self.RbtnFemale.configure(justify='left') self.RbtnFemale.configure(text='''FEMALE''') self.RbtnFemale.configure(value=1) self.RbtnFemale.configure(variable=self.genderVal) self.health = tk.Label(top) self.health.place(x=890,y=100, height=35, width=150) self.health.configure(activebackground="#f9f9f9") self.health.configure(activeforeground="black") self.health.configure(background="#d9d9d9") self.health.configure(disabledforeground="#a3a3a3") self.health.configure(font="-family {Segoe UI} -size 12") self.health.configure(foreground="#000000") self.health.configure(highlightbackground="#d9d9d9") self.health.configure(highlightcolor="black") self.health.configure(text='''LAST VACCINATED''') self.v1 = tk.Label(top) self.v1.place(x=800,y=155, height=35, width=98) self.v1.configure(activebackground="#f9f9f9") self.v1.configure(activeforeground="black") self.v1.configure(background="#d9d9d9") self.v1.configure(disabledforeground="#a3a3a3") self.v1.configure(foreground="#000000") self.v1.configure(highlightbackground="#d9d9d9") self.v1.configure(highlightcolor="black") self.v1.configure(text='''V1''') self.cal1 = DateEntry(top, width=12, year=2020, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal1.place(x=1000,y=155, height=35, width=98) self.v2 = tk.Label(top) self.v2.place(x=800,y=200, height=35, width=98) self.v2.configure(activebackground="#f9f9f9") self.v2.configure(activeforeground="black") self.v2.configure(background="#d9d9d9") self.v2.configure(disabledforeground="#a3a3a3") self.v2.configure(foreground="#000000") self.v2.configure(highlightbackground="#d9d9d9") self.v2.configure(highlightcolor="black") self.v2.configure(text='''V2''') self.cal2 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal2.place(x=1000,y=200, height=35, width=98) self.v3 = tk.Label(top) self.v3.place(x=800,y=245, height=35, width=98) self.v3.configure(activebackground="#f9f9f9") self.v3.configure(activeforeground="black") self.v3.configure(background="#d9d9d9") self.v3.configure(disabledforeground="#a3a3a3") self.v3.configure(foreground="#000000") self.v3.configure(highlightbackground="#d9d9d9") self.v3.configure(highlightcolor="black") self.v3.configure(text='''V3''') self.cal3 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal3.place(x=1000,y=245, height=35, width=98) self.v4 = tk.Label(top) self.v4.place(x=800,y=290, height=35, width=98) self.v4.configure(activebackground="#f9f9f9") self.v4.configure(activeforeground="black") self.v4.configure(background="#d9d9d9") self.v4.configure(disabledforeground="#a3a3a3") self.v4.configure(foreground="#000000") self.v4.configure(highlightbackground="#d9d9d9") self.v4.configure(highlightcolor="black") self.v4.configure(text='''V4''') self.cal4 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal4.place(x=1000,y=290, height=35, width=98) self.v5 = tk.Label(top) self.v5.place(x=800,y=335, height=35, width=98) self.v5.configure(activebackground="#f9f9f9") self.v5.configure(activeforeground="black") self.v5.configure(background="#d9d9d9") self.v5.configure(disabledforeground="#a3a3a3") self.v5.configure(foreground="#000000") self.v5.configure(highlightbackground="#d9d9d9") self.v5.configure(highlightcolor="black") self.v5.configure(text='''V5''') self.cal5 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal5.place(x=1000,y=335, height=35, width=98) self.v6 = tk.Label(top) self.v6.place(x=800,y=380, height=35, width=98) self.v6.configure(activebackground="#f9f9f9") self.v6.configure(activeforeground="black") self.v6.configure(background="#d9d9d9") self.v6.configure(disabledforeground="#a3a3a3") self.v6.configure(foreground="#000000") self.v6.configure(highlightbackground="#d9d9d9") self.v6.configure(highlightcolor="black") self.v6.configure(text='''V6''') self.cal6 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal6.place(x=1000,y=380, height=35, width=98) self.v7 = tk.Label(top) self.v7.place(x=800,y=425, height=35, width=98) self.v7.configure(activebackground="#f9f9f9") self.v7.configure(activeforeground="black") self.v7.configure(background="#d9d9d9") self.v7.configure(disabledforeground="#a3a3a3") self.v7.configure(foreground="#000000") self.v7.configure(highlightbackground="#d9d9d9") self.v7.configure(highlightcolor="black") self.v7.configure(text='''V7''') self.cal7 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal7.place(x=1000,y=425, height=35, width=98) self.v8 = tk.Label(top) self.v8.place(x=800,y=470, height=35, width=98) self.v8.configure(activebackground="#f9f9f9") self.v8.configure(activeforeground="black") self.v8.configure(background="#d9d9d9") self.v8.configure(disabledforeground="#a3a3a3") self.v8.configure(foreground="#000000") self.v8.configure(highlightbackground="#d9d9d9") self.v8.configure(highlightcolor="black") self.v8.configure(text='''V8''') self.cal8 = DateEntry(top, width=12, year=2019, month=6, day=22, background='darkblue', foreground='white', borderwidth=2) self.cal8.place(x=1000,y=470, height=35, width=98) self.Submit = tk.Button(top, command=self.acceptValues) self.Submit.place(relx=0.550, rely=0.842, height=30, width=59) self.Submit.configure(activebackground="#ececec") self.Submit.configure(activeforeground="#000000") self.Submit.configure(background="#d9d9d9") self.Submit.configure(disabledforeground="#a3a3a3") self.Submit.configure(foreground="#000000") self.Submit.configure(highlightbackground="#d9d9d9") self.Submit.configure(highlightcolor="black") self.Submit.configure(pady="0") self.Submit.configure(text='''SUBMIT''') self.Cancel = tk.Button(top, command=lambda: addGoat_support.destroy_window()) self.Cancel.place(relx=0.430, rely=0.842, height=30, width=59) self.Cancel.configure(activebackground="#ececec") self.Cancel.configure(activeforeground="#000000") self.Cancel.configure(background="#d9d9d9") self.Cancel.configure(disabledforeground="#a3a3a3") self.Cancel.configure(foreground="#000000") self.Cancel.configure(highlightbackground="#d9d9d9") self.Cancel.configure(highlightcolor="black") self.Cancel.configure(pady="0") self.Cancel.configure(text='''CANCEL''') self.goatDob.set_date(datetime.date(datetime.now())) self.cal1.set_date(datetime.date(datetime.now())) self.cal2.set_date(datetime.date(datetime.now())) self.cal3.set_date(datetime.date(datetime.now())) self.cal4.set_date(datetime.date(datetime.now())) self.cal5.set_date(datetime.date(datetime.now())) self.cal6.set_date(datetime.date(datetime.now())) self.cal7.set_date(datetime.date(datetime.now())) self.cal8.set_date(datetime.date(datetime.now())) self.disableVaccination() def acceptValues(self): try: goat_id = int(self.TEntry1.get()) g_breed = self.TEntry1_22.get() g_dob = self.goatDob.get_date() g_weight = int(self.TEntry1_24.get()) g_motherId = self.TEntry1_25.get() g_gender = 'm' if int(self.genderVal.get()) == 0 else 'f' g_isBornOrBought = self.isBornOrBought.get() v1Date = self.cal1.get_date() v2Date = self.cal2.get_date() v3Date = self.cal3.get_date() v4Date = self.cal4.get_date() v5Date = self.cal5.get_date() v6Date = self.cal6.get_date() v7Date = self.cal7.get_date() v8Date = self.cal8.get_date() # born = 0 print(g_isBornOrBought) addGoatData = {'goat_id': goat_id, 'breed': g_breed, 'date_of_birth': g_dob, 'weight': g_weight, 'gender': g_gender, 'pregnant': 'No', 'v1': str(v1Date), 'v2': str(v2Date), 'v3': str(v3Date), 'v4': str(v4Date), 'v5': str(v5Date), 'v6': str(v6Date), 'v7': str(v7Date), 'v8': str(v8Date), 'curdate': datetime.date(datetime.now())} if g_gender == 'f' and g_isBornOrBought == 0: self.db.insertGoatRecord(addGoatData, mother_id=g_motherId) elif g_gender == 'f' and g_isBornOrBought == 1: self.db.insertGoatRecord(addGoatData, mother_id='null') elif g_gender == 'm' and g_isBornOrBought == 0: self.db.insertGoatRecord(addGoatData, mother_id=g_motherId) elif g_gender == 'm' and g_isBornOrBought == 1: self.db.insertGoatRecord(addGoatData, mother_id='null') except: self.errorMsg() else: self.showSuccess() print({'goat_id': goat_id, 'breed': g_breed, 'date_of_birth': g_dob, 'weight': g_weight, 'gender': g_gender, 'pregnant': 'No', 'v1': str(v1Date), 'v2': str(v2Date), 'v3': str(v3Date), 'v4': str(v4Date), 'v5': str(v5Date), 'v6': str(v6Date), 'v7': str(v6Date), 'v8': str(v6Date)}) addGoat_support.destroy_window() def disableVaccination(self): self.TEntry1_25.config(state=NORMAL) self.cal1.config(state=DISABLED) self.cal2.config(state=DISABLED) self.cal3.config(state=DISABLED) self.cal4.config(state=DISABLED) self.cal5.config(state=DISABLED) self.cal6.config(state=DISABLED) self.cal7.config(state=DISABLED) self.cal8.config(state=DISABLED) def disableMotherId(self): self.TEntry1_25.config(state=DISABLED) self.cal1.config(state=NORMAL) self.cal2.config(state=NORMAL) self.cal3.config(state=NORMAL) self.cal4.config(state=NORMAL) self.cal5.config(state=NORMAL) self.cal6.config(state=NORMAL) self.cal7.config(state=NORMAL) self.cal8.config(state=NORMAL) def errorMsg(self): tk.messagebox.showerror("Input Error","Incorrect Data!") def showSuccess(self): tk.messagebox.showinfo("Success","Successfully Inserted")
def getData(): db = DataBase() data = db.getGoatRecords() dataColumns = db.getColumnNames() df = pd.DataFrame(data, columns=dataColumns) if not df['breed'].empty: breed = df['breed'] gender = df['gender'] else: breed = [''] gender = [''] kidCount = db.getKidCount() maleKidCount = 0 femaleKidCount = 0 if len(kidCount) > 1: if kidCount[0][1] == 'm': maleKidCount = kidCount[0][0] femaleKidCount = kidCount[1][0] else: maleKidCount = kidCount[1][0] femaleKidCount = kidCount[0][0] elif len(kidCount) == 1: if kidCount[0][1] == 'm': maleKidCount = kidCount[0][0] else: femaleKidCount = kidCount[0][0] else: maleKidCount = 0 femaleKidCount = 0 deadCount = db.getDeadCount() maleDeadCount = 0 femaleDeadCount = 0 if len(deadCount) > 1: if deadCount[0][1] == 'm': maleDeadCount = deadCount[0][0] femaleDeadCount = deadCount[1][0] else: maleDeadCount = deadCount[1][0] femaleDeadCount = deadCount[0][0] elif len(deadCount) == 1: if deadCount[0][1] == 'm': maleDeadCount = deadCount[0][0] else: femaleDeadCount = deadCount[0][0] else: maleDeadCount = 0 femaleDeadCount = 0 income = db.getTotalIncome() + db.getTotalSoldGoatsRate() expense = db.getTotalLabourCost() + db.getTotalFeedCost( ) + db.getTotalMiscExpenditure() db = None return breed, gender, maleKidCount, femaleKidCount, maleDeadCount, femaleDeadCount, income, expense
def __init__(self, top=None, goatData=[]): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' font10 = "-family {Segoe UI} -size 13" font12 = "-family {Segoe UI} -size 16 -weight bold" font13 = "-family {Segoe UI Semibold} -size 13 -weight bold" font9 = "-family {Segoe UI} -size 20 -weight bold" top.geometry("1300x760+20+20") top.minsize(800, 500) top.maxsize(1800, 850) top.resizable(1, 1) top.title("View") top.configure(background="#d9d9d9") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.goatData = goatData self.db = DataBase() self.Button0 = tk.Button(top, command=destroy_Toplevel1) self.Button0.place(x=10, y=8, height=33, width=56) self.Button0.configure(activebackground="#ececec") self.Button0.configure(activeforeground="#000000") self.Button0.configure(background="#d9d9d9") self.Button0.configure(disabledforeground="#a3a3a3") self.Button0.configure(foreground="#000000") self.Button0.configure(highlightbackground="#d9d9d9") self.Button0.configure(highlightcolor="black") self.Button0.configure(pady="0") self.Button0.configure(text='''< Back''') self.Label1 = tk.Label(top) self.Label1.place(relx=0.416, rely=0.0, height=52, width=173) self.Label1.configure(activebackground="#f9f9f9") self.Label1.configure(activeforeground="black") self.Label1.configure(background="#d9d9d9") self.Label1.configure(disabledforeground="#a3a3a3") self.Label1.configure(font=font9) self.Label1.configure(foreground="#000000") self.Label1.configure(highlightbackground="#d9d9d9") self.Label1.configure(highlightcolor="black") self.Label1.configure(text='''About Goat''') self.Label2 = tk.Label(top) self.Label2.place(relx=0.051, rely=0.017, height=52, width=112) self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(activeforeground="black") self.Label2.configure(background="#d9d9d9") self.Label2.configure(disabledforeground="#a3a3a3") self.Label2.configure(font=("font10", 10)) self.Label2.configure(foreground="#000000") self.Label2.configure(highlightbackground="#d9d9d9") self.Label2.configure(highlightcolor="black") self.Label2.configure(text='''Goat ID''') self.Label2_1 = tk.Label(top) self.Label2_1.place(relx=0.051, rely=0.072, height=52, width=112) self.Label2_1.configure(activebackground="#f9f9f9") self.Label2_1.configure(activeforeground="black") self.Label2_1.configure(background="#d9d9d9") self.Label2_1.configure(disabledforeground="#a3a3a3") self.Label2_1.configure(font=("font10", 10)) self.Label2_1.configure(foreground="#000000") self.Label2_1.configure(highlightbackground="#d9d9d9") self.Label2_1.configure(highlightcolor="black") self.Label2_1.configure(text='''Breed''') self.Label2_2 = tk.Label(top) self.Label2_2.place(relx=0.051, rely=0.134, height=40, width=112) self.Label2_2.configure(activebackground="#f9f9f9") self.Label2_2.configure(activeforeground="black") self.Label2_2.configure(background="#d9d9d9") self.Label2_2.configure(disabledforeground="#a3a3a3") self.Label2_2.configure(font=("font10", 10)) self.Label2_2.configure(foreground="#000000") self.Label2_2.configure(highlightbackground="#d9d9d9") self.Label2_2.configure(highlightcolor="black") self.Label2_2.configure(text='''DOB''') self.Label2_3 = tk.Label(top) self.Label2_3.place(relx=0.051, rely=0.177, height=53, width=112) self.Label2_3.configure(activebackground="#f9f9f9") self.Label2_3.configure(activeforeground="black") self.Label2_3.configure(background="#d9d9d9") self.Label2_3.configure(disabledforeground="#a3a3a3") self.Label2_3.configure(font=("font10", 10)) self.Label2_3.configure(foreground="#000000") self.Label2_3.configure(highlightbackground="#d9d9d9") self.Label2_3.configure(highlightcolor="black") self.Label2_3.configure(text='''Gender''') self.Label2_4 = tk.Label(top) self.Label2_4.place(relx=0.071, rely=0.300, height=52, width=266) self.Label2_4.configure(activebackground="#f9f9f9") self.Label2_4.configure(activeforeground="black") self.Label2_4.configure(background="#d9d9d9") self.Label2_4.configure(disabledforeground="#a3a3a3") self.Label2_4.configure(font=font12) self.Label2_4.configure(foreground="#000000") self.Label2_4.configure(highlightbackground="#d9d9d9") self.Label2_4.configure(highlightcolor="black") self.Label2_4.configure(text='''Last Vaccinated Date''') self.Text1 = tk.Text(top) self.Text1.place(relx=0.152, rely=0.025, relheight=0.036, relwidth=0.139) self.Text1.configure(background="white") self.Text1.configure(font="TkTextFont") self.Text1.configure(foreground="black") self.Text1.configure(highlightbackground="#d9d9d9") self.Text1.configure(highlightcolor="black") self.Text1.configure(insertbackground="black") self.Text1.configure(selectbackground="#c4c4c4") self.Text1.configure(selectforeground="black") self.Text1.configure(wrap="word") self.Text1_12 = tk.Text(top) self.Text1_12.place(relx=0.152, rely=0.080, relheight=0.036, relwidth=0.139) self.Text1_12.configure(background="white") self.Text1_12.configure(font="TkTextFont") self.Text1_12.configure(foreground="black") self.Text1_12.configure(highlightbackground="#d9d9d9") self.Text1_12.configure(highlightcolor="black") self.Text1_12.configure(insertbackground="black") self.Text1_12.configure(selectbackground="#c4c4c4") self.Text1_12.configure(selectforeground="black") self.Text1_12.configure(wrap="word") self.Text1_12.insert(END, self.goatData[4]) self.Text1_13 = tk.Text(top) self.Text1_13.place(relx=0.152, rely=0.137, relheight=0.035, relwidth=0.139) self.Text1_13.configure(background="white") self.Text1_13.configure(font="TkTextFont") self.Text1_13.configure(foreground="black") self.Text1_13.configure(highlightbackground="#d9d9d9") self.Text1_13.configure(highlightcolor="black") self.Text1_13.configure(insertbackground="black") self.Text1_13.configure(selectbackground="#c4c4c4") self.Text1_13.configure(selectforeground="black") self.Text1_13.configure(wrap="word") self.Text1_13.insert(END, self.goatData[2]) self.Text1_14 = tk.Text(top) self.Text1_14.place(relx=0.152, rely=0.190, relheight=0.035, relwidth=0.139) self.Text1_14.configure(background="white") self.Text1_14.configure(font="TkTextFont") self.Text1_14.configure(foreground="black") self.Text1_14.configure(highlightbackground="#d9d9d9") self.Text1_14.configure(highlightcolor="black") self.Text1_14.configure(insertbackground="black") self.Text1_14.configure(selectbackground="#c4c4c4") self.Text1_14.configure(selectforeground="black") self.Text1_14.configure(wrap="word") self.Text1_14.insert(END, self.goatData[3]) self.Text1_15 = tk.Text(top) self.Text1_15.place(relx=0.159, rely=0.405, relheight=0.036, relwidth=0.139) self.Text1_15.configure(background="white") self.Text1_15.configure(font="TkTextFont") self.Text1_15.configure(foreground="black") self.Text1_15.configure(highlightbackground="#d9d9d9") self.Text1_15.configure(highlightcolor="black") self.Text1_15.configure(insertbackground="black") self.Text1_15.configure(selectbackground="#c4c4c4") self.Text1_15.configure(selectforeground="black") self.Text1_15.configure(wrap="word") self.Text1_15.insert(END, self.goatData[11]) self.Text1_16 = tk.Text(top) self.Text1_16.place(relx=0.159, rely=0.475, relheight=0.036, relwidth=0.139) self.Text1_16.configure(background="white") self.Text1_16.configure(font="TkTextFont") self.Text1_16.configure(foreground="black") self.Text1_16.configure(highlightbackground="#d9d9d9") self.Text1_16.configure(highlightcolor="black") self.Text1_16.configure(insertbackground="black") self.Text1_16.configure(selectbackground="#c4c4c4") self.Text1_16.configure(selectforeground="black") self.Text1_16.configure(wrap="word") self.Text1_16.insert(END, self.goatData[12]) self.Text1_17 = tk.Text(top) self.Text1_17.place(relx=0.159, rely=0.540, relheight=0.036, relwidth=0.139) self.Text1_17.configure(background="white") self.Text1_17.configure(font="TkTextFont") self.Text1_17.configure(foreground="black") self.Text1_17.configure(highlightbackground="#d9d9d9") self.Text1_17.configure(highlightcolor="black") self.Text1_17.configure(insertbackground="black") self.Text1_17.configure(selectbackground="#c4c4c4") self.Text1_17.configure(selectforeground="black") self.Text1_17.configure(wrap="word") self.Text1_17.insert(END, self.goatData[13]) self.Text1_18 = tk.Text(top) self.Text1_18.place(relx=0.159, rely=0.600, relheight=0.036, relwidth=0.139) self.Text1_18.configure(background="white") self.Text1_18.configure(font="TkTextFont") self.Text1_18.configure(foreground="black") self.Text1_18.configure(highlightbackground="#d9d9d9") self.Text1_18.configure(highlightcolor="black") self.Text1_18.configure(insertbackground="black") self.Text1_18.configure(selectbackground="#c4c4c4") self.Text1_18.configure(selectforeground="black") self.Text1_18.configure(wrap="word") self.Text1_18.insert(END, self.goatData[14]) self.Text1_19 = tk.Text(top) self.Text1_19.place(relx=0.159, rely=0.665, relheight=0.036, relwidth=0.139) self.Text1_19.configure(background="white") self.Text1_19.configure(font="TkTextFont") self.Text1_19.configure(foreground="black") self.Text1_19.configure(highlightbackground="#d9d9d9") self.Text1_19.configure(highlightcolor="black") self.Text1_19.configure(insertbackground="black") self.Text1_19.configure(selectbackground="#c4c4c4") self.Text1_19.configure(selectforeground="black") self.Text1_19.configure(wrap="word") self.Text1_19.insert(END, self.goatData[15]) self.Text1_20 = tk.Text(top) self.Text1_20.place(relx=0.159, rely=0.730, relheight=0.036, relwidth=0.139) self.Text1_20.configure(background="white") self.Text1_20.configure(font="TkTextFont") self.Text1_20.configure(foreground="black") self.Text1_20.configure(highlightbackground="#d9d9d9") self.Text1_20.configure(highlightcolor="black") self.Text1_20.configure(insertbackground="black") self.Text1_20.configure(selectbackground="#c4c4c4") self.Text1_20.configure(selectforeground="black") self.Text1_20.configure(wrap="word") self.Text1_20.insert(END, self.goatData[16]) self.Text205 = tk.Text(top) self.Text205.place(relx=0.159, rely=0.800, relheight=0.036, relwidth=0.139) self.Text205.configure(background="white") self.Text205.configure(font="TkTextFont") self.Text205.configure(foreground="black") self.Text205.configure(highlightbackground="#d9d9d9") self.Text205.configure(highlightcolor="black") self.Text205.configure(insertbackground="black") self.Text205.configure(selectbackground="#c4c4c4") self.Text205.configure(selectforeground="black") self.Text205.configure(wrap="word") self.Text205.insert(END, self.goatData[17]) self.Text305 = tk.Text(top) self.Text305.place(relx=0.159, rely=0.865, relheight=0.036, relwidth=0.139) self.Text305.configure(background="white") self.Text305.configure(font="TkTextFont") self.Text305.configure(foreground="black") self.Text305.configure(highlightbackground="#d9d9d9") self.Text305.configure(highlightcolor="black") self.Text305.configure(insertbackground="black") self.Text305.configure(selectbackground="#c4c4c4") self.Text305.configure(selectforeground="black") self.Text305.configure(wrap="word") self.Text305.insert(END, self.goatData[18]) self.Canvas1 = tk.Text(top) self.Canvas1.place(relx=0.159, rely=0.927, relheight=0.049, relwidth=0.138) self.Canvas1.configure(background="white") self.Canvas1.configure(font="TkTextFont") self.Canvas1.configure(foreground="black") self.Canvas1.configure(highlightbackground="#d9d9d9") self.Canvas1.configure(highlightcolor="black") self.Canvas1.configure(insertbackground="black") self.Canvas1.configure(selectbackground="#c4c4c4") self.Canvas1.configure(selectforeground="black") self.Canvas1.configure(wrap="word") self.Frame2 = tk.Frame(top) self.Frame2.place(relx=0.599, rely=0.075, relheight=0.92, relwidth=0.39) self.Frame2.configure(relief='groove') self.Frame2.configure(borderwidth="2") self.Frame2.configure(relief="groove") self.Frame2.configure(background="#d9d9d9") self.Frame2.configure(highlightbackground="#d9d9d9") self.Frame2.configure(highlightcolor="black") self.Label2_00 = tk.Label(self.Frame2) self.Label2_00.place(relx=0.1, rely=0.066, height=52, width=141) self.Label2_00.configure(activebackground="#f9f9f9") self.Label2_00.configure(activeforeground="black") self.Label2_00.configure(background="#d9d9d9") self.Label2_00.configure(disabledforeground="#a3a3a3") self.Label2_00.configure(font=font10) self.Label2_00.configure(foreground="#000000") self.Label2_00.configure(highlightbackground="#d9d9d9") self.Label2_00.configure(highlightcolor="black") self.Label2_00.configure(text='''Pregnant''') self.Canvas2 = tk.Text(self.Frame2) self.Canvas2.place(relx=0.469, rely=0.066, relheight=0.055, relwidth=0.346) self.Canvas2.configure(background="white") self.Canvas2.configure(font="TkTextFont") self.Canvas2.configure(foreground="black") self.Canvas2.configure(highlightbackground="#d9d9d9") self.Canvas2.configure(highlightcolor="black") self.Canvas2.configure(insertbackground="black") self.Canvas2.configure(selectbackground="#c4c4c4") self.Canvas2.configure(selectforeground="black") self.Canvas2.configure(wrap="word") self.Label2_7 = tk.Label(self.Frame2) self.Label2_7.place(relx=0.25, rely=0.15, height=51, width=174) self.Label2_7.configure(activebackground="#f9f9f9") self.Label2_7.configure(activeforeground="black") self.Label2_7.configure(background="#d9d9d9") self.Label2_7.configure(disabledforeground="#a3a3a3") self.Label2_7.configure(font=font13) self.Label2_7.configure(foreground="#000000") self.Label2_7.configure(highlightbackground="#d9d9d9") self.Label2_7.configure(highlightcolor="black") self.Label2_7.configure(text='''Kid Details''') self.Label2_8 = tk.Label(self.Frame2) self.Label2_8.place(relx=0.1, rely=0.24, height=50, width=140) self.Label2_8.configure(activebackground="#f9f9f9") self.Label2_8.configure(activeforeground="black") self.Label2_8.configure(background="#d9d9d9") self.Label2_8.configure(disabledforeground="#a3a3a3") self.Label2_8.configure(font=font10) self.Label2_8.configure(foreground="#000000") self.Label2_8.configure(highlightbackground="#d9d9d9") self.Label2_8.configure(highlightcolor="black") self.Label2_8.configure(text='''No of Male Kids''') self.Text2_9 = tk.Text(self.Frame2) self.Text2_9.place(relx=0.469, rely=0.25, relheight=0.055, relwidth=0.346) self.Text2_9.configure(background="white") self.Text2_9.configure(font="TkTextFont") self.Text2_9.configure(foreground="black") self.Text2_9.configure(highlightbackground="#d9d9d9") self.Text2_9.configure(highlightcolor="black") self.Text2_9.configure(insertbackground="black") self.Text2_9.configure(selectbackground="#c4c4c4") self.Text2_9.configure(selectforeground="black") self.Text2_9.configure(wrap="word") self.Text2_9.insert(END, self.goatData[8]) self.Label2_6 = tk.Label(self.Frame2) self.Label2_6.place(relx=0.1, rely=0.34, height=50, width=141) self.Label2_6.configure(activebackground="#f9f9f9") self.Label2_6.configure(activeforeground="black") self.Label2_6.configure(background="#d9d9d9") self.Label2_6.configure(disabledforeground="#a3a3a3") self.Label2_6.configure(font=font10) self.Label2_6.configure(foreground="#000000") self.Label2_6.configure(highlightbackground="#d9d9d9") self.Label2_6.configure(highlightcolor="black") self.Label2_6.configure(text='''No of Female Kids''') self.Text2 = tk.Text(self.Frame2) self.Text2.place(relx=0.469, rely=0.35, relheight=0.055, relwidth=0.346) self.Text2.configure(background="white") self.Text2.configure(font="TkTextFont") self.Text2.configure(foreground="black") self.Text2.configure(highlightbackground="#d9d9d9") self.Text2.configure(highlightcolor="black") self.Text2.configure(insertbackground="black") self.Text2.configure(selectbackground="#c4c4c4") self.Text2.configure(selectforeground="black") self.Text2.configure(wrap="word") self.Text2.insert(END, self.goatData[9]) self.Frame3 = tk.Frame(self.Frame2) self.Frame3.place(relx=0.234, rely=0.525, relheight=0.442, relwidth=0.612) self.Frame3.configure(relief='groove') self.Frame3.configure(borderwidth="2") self.Frame3.configure(relief="groove") self.Frame3.configure(background="#d9d9d9") self.tree3 = ttk.Treeview(self.Frame3) self.tree3.place(relx=0.00, rely=0.00, height=300, width=310) self.tree3["columns"] = ("#0", "#1", "#2", "#3") self.tree3.column("#0", width=50, stretch=True, anchor='center') self.tree3.column("#1", width=80, stretch=True, anchor='center') self.tree3.column("#2", width=80, stretch=True, anchor='center') self.tree3.column("#3", width=80, stretch=True, anchor='center') self.tree3.heading("#0", text="S.NO") self.tree3.heading("#1", text="MOTHER ID") self.tree3.heading("#2", text="KID ID") self.tree3.heading("#3", text="GENDER") self.Label2_1 = tk.Label(top) self.Label2_1.place(relx=0.041, rely=0.390, height=53, width=113) self.Label2_1.configure(activebackground="#f9f9f9") self.Label2_1.configure(activeforeground="black") self.Label2_1.configure(background="#d9d9d9") self.Label2_1.configure(disabledforeground="#a3a3a3") self.Label2_1.configure(font=("font10", 10)) self.Label2_1.configure(foreground="#000000") self.Label2_1.configure(highlightbackground="#d9d9d9") self.Label2_1.configure(highlightcolor="black") self.Label2_1.configure(text='''Anthrax''') self.Label2_2 = tk.Label(top) self.Label2_2.place(relx=0.011, rely=0.460, height=52, width=195) self.Label2_2.configure(activebackground="#f9f9f9") self.Label2_2.configure(activeforeground="black") self.Label2_2.configure(background="#d9d9d9") self.Label2_2.configure(disabledforeground="#a3a3a3") self.Label2_2.configure(font=("font10", 10)) self.Label2_2.configure(foreground="#000000") self.Label2_2.configure(highlightbackground="#d9d9d9") self.Label2_2.configure(highlightcolor="black") self.Label2_2.configure(text='''Haemorrhagic Septicemia(H.S)''') self.Label2_3 = tk.Label(top) self.Label2_3.place(relx=0.041, rely=0.530, height=53, width=113) self.Label2_3.configure(activebackground="#f9f9f9") self.Label2_3.configure(activeforeground="black") self.Label2_3.configure(background="#d9d9d9") self.Label2_3.configure(disabledforeground="#a3a3a3") self.Label2_3.configure(font=("font10", 10)) self.Label2_3.configure(foreground="#000000") self.Label2_3.configure(highlightbackground="#d9d9d9") self.Label2_3.configure(highlightcolor="black") self.Label2_3.configure(text='''Enterotoxaemia''') self.Label2_5 = tk.Label(top) self.Label2_5.place(relx=0.041, rely=0.590, height=52, width=114) self.Label2_5.configure(activebackground="#f9f9f9") self.Label2_5.configure(activeforeground="black") self.Label2_5.configure(background="#d9d9d9") self.Label2_5.configure(disabledforeground="#a3a3a3") self.Label2_5.configure(font=("font10", 10)) self.Label2_5.configure(foreground="#000000") self.Label2_5.configure(highlightbackground="#d9d9d9") self.Label2_5.configure(highlightcolor="black") self.Label2_5.configure(text='''Black Quarter''') self.Label2_5 = tk.Label(top) self.Label2_5.place(relx=0.011, rely=0.655, height=52, width=195) self.Label2_5.configure(activebackground="#f9f9f9") self.Label2_5.configure(activeforeground="black") self.Label2_5.configure(background="#d9d9d9") self.Label2_5.configure(disabledforeground="#a3a3a3") self.Label2_5.configure(font=("font10", 10)) self.Label2_5.configure(foreground="#000000") self.Label2_5.configure(highlightbackground="#d9d9d9") self.Label2_5.configure(highlightcolor="black") self.Label2_5.configure(text='''P.P.R.''') self.Label2_5 = tk.Label(top) self.Label2_5.place(relx=0.011, rely=0.720, height=52, width=180) self.Label2_5.configure(activebackground="#f9f9f9") self.Label2_5.configure(activeforeground="black") self.Label2_5.configure(background="#d9d9d9") self.Label2_5.configure(disabledforeground="#a3a3a3") self.Label2_5.configure(font=("font10", 10)) self.Label2_5.configure(foreground="#000000") self.Label2_5.configure(highlightbackground="#d9d9d9") self.Label2_5.configure(highlightcolor="black") self.Label2_5.configure(text='''Foot and Mouth Disease''') self.label205 = tk.Label(top) self.label205.place(relx=0.041, rely=0.790, height=52, width=113) self.label205.configure(activebackground="#f9f9f9") self.label205.configure(activeforeground="black") self.label205.configure(background="#d9d9d9") self.label205.configure(disabledforeground="#a3a3a3") self.label205.configure(font=("font10", 10)) self.label205.configure(foreground="#000000") self.label205.configure(highlightbackground="#d9d9d9") self.label205.configure(highlightcolor="black") self.label205.configure(text='''Goat Pox''') self.label305 = tk.Label(top) self.label305.place(relx=0.041, rely=0.860, height=52, width=113) self.label305.configure(activebackground="#f9f9f9") self.label305.configure(activeforeground="black") self.label305.configure(background="#d9d9d9") self.label305.configure(disabledforeground="#a3a3a3") self.label305.configure(font=("font10", 10)) self.label305.configure(foreground="#000000") self.label305.configure(highlightbackground="#d9d9d9") self.label305.configure(highlightcolor="black") self.label305.configure(text='''C.C.P.P''') self.Label2_5 = tk.Label(top) self.Label2_5.place(relx=0.051, rely=0.923, height=52, width=93) self.Label2_5.configure(activebackground="#f9f9f9") self.Label2_5.configure(activeforeground="black") self.Label2_5.configure(background="#d9d9d9") self.Label2_5.configure(disabledforeground="#a3a3a3") self.Label2_5.configure(font=font13) self.Label2_5.configure(foreground="#000000") self.Label2_5.configure(highlightbackground="#d9d9d9") self.Label2_5.configure(highlightcolor="black") self.Label2_5.configure(text='''Mortality''') self.Label2_5 = tk.Label(top) self.Label2_5.place(relx=0.051, rely=0.238, height=52, width=113) self.Label2_5.configure(activebackground="#f9f9f9") self.Label2_5.configure(activeforeground="black") self.Label2_5.configure(background="#d9d9d9") self.Label2_5.configure(disabledforeground="#a3a3a3") self.Label2_5.configure(font=("font10", 10)) self.Label2_5.configure(foreground="#000000") self.Label2_5.configure(highlightbackground="#d9d9d9") self.Label2_5.configure(highlightcolor="black") self.Label2_5.configure(text='''Weight''') self.Text1_5 = tk.Text(top) self.Text1_5.place(relx=0.152, rely=0.250, relheight=0.036, relwidth=0.139) self.Text1_5.configure(background="white") self.Text1_5.configure(font="TkTextFont") self.Text1_5.configure(foreground="black") self.Text1_5.configure(highlightbackground="#d9d9d9") self.Text1_5.configure(highlightcolor="black") self.Text1_5.configure(insertbackground="black") self.Text1_5.configure(selectbackground="#c4c4c4") self.Text1_5.configure(selectforeground="black") self.Text1_5.configure(wrap="word") self.Text1_5.insert(END, self.goatData[5]) self.Text1.insert(END, self.goatData[0]) self.isAlive = self.goatData[10] self.Canvas1.insert(END, self.isAlive) self.isPregnant = self.goatData[4] self.Canvas2.insert(END, self.isPregnant) if goatData[3] == 'm': self.Frame2.place_forget() self.populateTree() counter = 0 self.Frame1 = tk.Frame(top) self.Frame1.place(relx=0.325, rely=0.512, relheight=0.45, relwidth=0.237) self.Frame1.configure(relief='groove') self.Frame1.configure(borderwidth="2") self.Frame1.configure(relief="groove") self.Frame1.configure(background="#d9d9d9") self.Frame1.configure(highlightbackground="#d9d9d9") self.Frame1.configure(highlightcolor="black") # Weight graph data1 = self.db.getWeightRecords(goatData[0]) dataColumns1 = self.db.getWeightColumnNames(goatData[0]) df = pd.DataFrame(data1, columns=dataColumns1) figure = plt.Figure(figsize=(6, 7), dpi=50) ax1 = figure.add_subplot(111) line2 = FigureCanvasTkAgg(figure, self.Frame1) line2.get_tk_widget().pack(side=tk.LEFT, fill=tk.NONE, padx=2) df.plot(kind='line', legend=True, ax=ax1, color='r', marker='o', fontsize=15) ax1.set_title('Chart of Growth') ax1.set_xlabel('Date_checked') ax1.set_xticks(np.arange(df.shape[0]) + 0.5, minor=False) ax1.set_xticklabels(df.date_checked, rotation=45, fontsize=10)