def toprightmostpart(): try: global canvas4, username, photo_image6, photo_image7, login if login == 0: if canvas4 is not None: canvas4.config(height=0, width=0) canvas4.delete("all") elif login == 1: if canvas4 is not None: canvas4.config(height=0, width=0) canvas4.delete("all") canvas4 = Canvas( root, bg="white", width=230, height=100, highlightthickness=0 ) # highlightbackground="black",highlightthickness=5) canvas4.place(x=root.winfo_screenwidth() - 270, y=50) canvas4.create_text(80, 25, fill="black", font="Times 14 bold", text="Login : "******"blue", font="Times 14 bold ", text=str(user).title()) image6 = Image.open("Pictures/signout.png") image6 = image6.resize((30, 30), Image.ANTIALIAS) photo_image6 = ImageTk.PhotoImage(image6) button1 = HoverButton(canvas4, compound=TOP, bg="black", image=photo_image6, borderwidth=0, command=homemiddlepart(user), activebackground='blue', cursor="hand2") button1.place(x=120, y=50) image7 = Image.open("Pictures/homeicon.jpg") image7 = image7.resize((30, 30), Image.ANTIALIAS) photo_image7 = ImageTk.PhotoImage(image7) button2 = HoverButton(canvas4, compound=TOP, fg="white", bg="black", image=photo_image7, borderwidth=0, command=lambda: homemiddlepart(user), activebackground='blue', cursor="hand2") button2.place(x=60, y=50) except: log_except()
def on_closing(): try: logging.info("On closing ") d = dialoguebox(root, text="Do you want to exit the application?", buttons=["Yes", "No"], default=0, cancel=2, title=warn, icon='Pictures/warn.png') if (d.go()) == 0: force_kill() except: log_except()
def force_kill(): try: logging.info("In force kill... ") if envMode == "development": os.system("taskkill /f /im database_Server.py 1>nul") os._exit(0) else: if (platform.system() == "Windows"): os.system("taskkill /f /im database_Server.exe 1>nul 2>nul") os._exit(0) else: os.system("sudo pkill database_Server") os._exit(0) except: log_except()
def registration(): try: global canvas5,canvas2, canvas4,canvas1, back,ship_entry,\ cap_phone_entry,ship_email_entry, ship_email_pwd_entry,login_pwd_entry,label_msg back.append(3) # if canvas1 is not None: # canvas1.config(height=0, width=0) # canvas1.delete("all") if canvas5 is not None: canvas5.config(height=0, width=0) canvas5.delete("all") if canvas4 is not None: canvas4.config(height=0, width=0) canvas4.delete("all") if canvas is not None: canvas.destroy() if canvas5 is not None: canvas5.destroy() login = 1 ship_name = StringVar() cap_phone = StringVar() ship_email = StringVar() ship_email_pwd = StringVar() login_pwd = StringVar() canvas1 = Canvas(root, bg="white", width=root.winfo_screenwidth(), height=20, highlightbackground="black", highlightthickness=5) canvas1.place(x=0, y=0) canvas1.create_text(root.winfo_screenwidth() / 2, 15, fill="black", font="Times 12 italic bold", text="Registration") #toprightmostpart() canvas5 = Canvas(root, bg="white", width=1000, height=500, bd=0, relief='ridge', highlightthickness=0) canvas5.place(x=200, y=200) label_msg = Label(canvas5, font="Times 13", text="", bg="white", fg="blue", width=50) label_msg.place(x=180, y=35) canvas5.create_text(180, 80, fill="black", font="Times 20 italic bold", text="Ship Name* : ") canvas5.create_text(180, 160, fill="black", font="Times 20 italic bold", text="Phone : ") canvas5.create_text(180, 240, fill="black", font="Times 20 italic bold", text="Email ID* : ") canvas5.create_text(180, 300, fill="black", font="Times 20 italic bold", text="Email Password* : ") canvas5.create_text(180, 380, fill="black", font="Times 20 italic bold", text="Login Password* : ") ship_entry = Entry(canvas5, textvariable=ship_name, bd=3, width=11, font=font_size, validate="key") ship_entry.place(x=360, y=70) cap_phone_entry = Entry(canvas5, textvariable=cap_phone, bd=3, width=11, font=font_size, validate="key") cap_phone_entry.place(x=360, y=140) ship_email_entry = Entry(canvas5, textvariable=ship_email, bd=3, width=11, font=font_size, validate="key") ship_email_entry.place(x=360, y=210) ship_email_pwd_entry = Entry(canvas5, show="*", textvariable=ship_email_pwd, bd=3, width=11, font=font_size, validate="key") ship_email_pwd_entry.place(x=360, y=280) login_pwd_entry = Entry(canvas5, show="*", textvariable=login_pwd, bd=3, width=11, font=font_size, validate="key") login_pwd_entry.place(x=360, y=350) save_button = HoverButton(canvas5, text="Save", bg="#007ED9", fg="white", font=('Helvetica', '15'), width=15, command=lambda: saveDetails(), activebackground='blue', cursor="hand2") save_button.place(x=180, y=420) back_button = HoverButton(canvas6, image=photo_image9, width=90, height=backButton_height, bg="white", borderwidth=0, font=('Helvetica', '15'), command=backpage, cursor="hand2") back_button.place(x=50, y=580) back_button = HoverButton(canvas6, image=photo_image9, width=90, height=backButton_height, bg="white", activebackground='white', borderwidth=0, font=('Helvetica', '15'), command=backpage, cursor="hand2") back_button.place(x=50, y=580) except: log_except()
def homemiddlepart(user): try: global canvas5, report_image,image2, canvas4, canvas1, \ login, back, photo_image6, reportGameGraph, canvas2 # back.append(1) if canvas1 is not None: canvas1.config(height=0, width=0) canvas1.delete("all") if canvas5 is not None: canvas5.config(height=0, width=0) canvas5.delete("all") if canvas4 is not None: canvas4.config(height=0, width=0) canvas4.delete("all") if canvas2 is not None: canvas2.config(height=0, width=0) canvas2.delete("all") if canvas is not None: canvas.destroy() login = 1 canvas1 = Canvas(root, bg="white", width=root.winfo_screenwidth(), height=20, highlightbackground="black", highlightthickness=5) canvas1.place(x=0, y=0) canvas1.create_text(root.winfo_screenwidth() / 2, 15, fill="black", font="Times 12 italic bold", text="Home") canvas2 = Canvas(root, bg="white", width=root.winfo_screenwidth() - 40, height=root.winfo_screenheight() - 165, highlightbackground="blue", highlightthickness=20) canvas2.place(x=0, y=30) # Images canvas2.create_image(150, 100, image=photo_image2) canvas4 = Canvas(root, bg="white", width=230, height=200, highlightthickness=0 ) # highlightbackground="black",highlightthickness=5) canvas4.place(x=root.winfo_screenwidth() - 270, y=50) canvas4.create_text(80, 25, fill="black", font="Times 14 bold", text="Login : "******"blue", font="Times 14 bold ", text=str(user).title()) image6 = Image.open("Pictures/signout.png") image6 = image6.resize((30, 30), Image.ANTIALIAS) photo_image6 = ImageTk.PhotoImage(image6) button1 = HoverButton(canvas4, compound=TOP, bg="black", image=photo_image6, borderwidth=0, command=loginPage) button1.place(x=120, y=50) canvas5 = Canvas(root, bg="white", width=1100, height=350, bd=0, relief='ridge', highlightthickness=0) canvas5.place(x=100, y=200) canvas5.create_text(450, 90, fill="black", font="Times 20 italic bold", text="Doctor Request") canvas5.create_text(720, 90, fill="black", font="Times 20 italic bold", text="Report") doctor_img = HoverButton(canvas5, compound=TOP, width=170, height=170, bg="white", image=doctor_image, borderwidth=0, cursor="hand2") #command=gamepage, doctor_img.place(x=370, y=140) report_img = HoverButton(canvas5, compound=TOP, width=170, height=170, bg="white", image=report_image, borderwidth=0, cursor="hand2") # command=lambda:runreport() report_img.place(x=640, y=140) # x=790, y=140 # ======================== except: log_except()
image7 = image7.resize((150, 150), Image.ANTIALIAS) photo_image7 = ImageTk.PhotoImage(image7) image13 = Image.open("Pictures/admin.png") image13 = image6.resize((30, 30), Image.ANTIALIAS) photo_image13 = ImageTk.PhotoImage(image13) image17 = Image.open("Pictures/patient_reg.png") image17 = image17.resize((170, 170), Image.ANTIALIAS) doctor_image = ImageTk.PhotoImage(image17) image9 = Image.open("Pictures/backbuttonicon.png") image9 = image9.resize((90, 90), Image.ANTIALIAS) photo_image9 = ImageTk.PhotoImage(image9) # spinnerwheel = spinningGIF.Spinner(root, size=64) # canvas2.create_window(int(root.winfo_screenwidth() / 2 - 50), int(root.winfo_screenheight() / 2 - 50), # window=spinnerwheel) except: log_except() #pass class HoverButton(tk.Button): def __init__(self, master, **kw): tk.Button.__init__(self, master=master, **kw) self.defaultBackground = self["background"] self.bind("<Enter>", self.on_enter) self.bind("<Leave>", self.on_leave) def on_enter(self, e): self['background'] = self['activebackground'] def on_leave(self, e):
def registration(): try: global canvas5,canvas2, canvas4,canvas1, back,ship_entry,\ ship_email_entry, ship_email_pwd_entry,login_pwd_entry,label_msg,login,ship_start_point,imo_number,ship_country_entry,\ call_sign_entry,imo_number_entry,username_entry,canvas_img back.append(3) if canvas_img is not None: canvas_img.config(height=0, width=0) canvas_img.delete("all") # if canvas1 is not None: # canvas1.config(height=0, width=0) # canvas1.delete("all") if canvas5 is not None: canvas5.config(height=0, width=0) canvas5.delete("all") # if canvas2 is not None: # canvas2.config(height=0, width=0) # canvas2.delete("all") if canvas4 is not None: canvas4.config(height=0, width=0) canvas4.delete("all") if canvas is not None: canvas.destroy() # if canvas5 is not None: # canvas5.destroy() login = 2 ship_name = StringVar() ship_country = StringVar() call_sign = StringVar() imo_number = StringVar() ship_email = StringVar() ship_email_pwd = StringVar() login_pwd = StringVar() ship_username = StringVar() canvas1 = Canvas(root, bg="white", width=root.winfo_screenwidth(), height=20, highlightbackground="black", highlightthickness=5) canvas1.place(x=0, y=0) canvas1.create_text(root.winfo_screenwidth() / 2, 15, fill="black", font="Times 12 italic bold", text="Maritime Doctor Registration Form") canvas5 = Canvas(root, width=800, height=600, bg="white", bd=0, relief='ridge', highlightthickness=0) canvas5.place(x=350, y=50) canvas6 = Canvas(root, bg="white", width=200, height=150, bd=0, relief='ridge', highlightthickness=0) canvas6.place(x=50, y=500) login = 1 toprightmostpart() label_msg = Label(canvas5, font="Times 13", text="", bg="white", fg="blue", width=50) label_msg.place(x=180, y=35) canvas5.create_text(180, 80, fill="black", font=reg_text_size, text=" Ship Name* : ") canvas5.create_text(180, 140, fill="black", font=reg_text_size, text="Call Sign* : ") canvas5.create_text(180, 200, fill="black", font=reg_text_size, text="IMO Number* : ") canvas5.create_text(180, 260, fill="black", font=reg_text_size, text="Email ID* : ") canvas5.create_text(180, 320, fill="black", font=reg_text_size, text="Email Password* : ") canvas5.create_text(180, 380, fill="black", font=reg_text_size, text="Username* : ") canvas5.create_text(180, 440, fill="black", font=reg_text_size, text="Login Password* : ") canvas5.create_text(180, 500, fill="black", font=reg_text_size, text="Country* : ") ship_entry = Entry(canvas5, textvariable=ship_name, bd=3, width=11, font=font_size, validate="key") ship_entry.place(x=360, y=65) call_sign_entry = Entry( canvas5, textvariable=call_sign, bd=3, width=11, font=font_size, ) call_sign_entry.place(x=360, y=125) imo_number_entry = Entry( canvas5, textvariable=imo_number, bd=3, width=11, font=font_size, ) imo_number_entry.place(x=360, y=185) # cap_phone_entry = Entry(canvas5, textvariable=cap_phone, bd=3, width=11, font=font_size, validate="key") # cap_phone_entry.place(x=360, y=140) ship_email_entry = Entry(canvas5, textvariable=ship_email, bd=3, width=11, font=font_size, validate="key") ship_email_entry.place(x=360, y=245) ship_email_pwd_entry = Entry(canvas5, show="*", textvariable=ship_email_pwd, bd=3, width=11, font=font_size, validate="key") ship_email_pwd_entry.place(x=360, y=305) username_entry = Entry(canvas5, textvariable=ship_username, bd=3, width=11, font=font_size, validate="key") username_entry.place(x=360, y=365) login_pwd_entry = Entry(canvas5, show="*", textvariable=login_pwd, bd=3, width=11, font=font_size, validate="key") login_pwd_entry.place(x=360, y=425) ship_country_entry = Entry( canvas5, textvariable=ship_country, bd=3, width=11, font=font_size, ) ship_country_entry.place(x=360, y=485) save_button = HoverButton(canvas5, text="Save", bg="#007ED9", fg="white", font=('Helvetica', '15'), width=15, command=lambda: saveDetails(), activebackground='blue', cursor="hand2") save_button.place(x=200, y=530) #350 back_button = HoverButton(canvas6, image=photo_image9, width=90, height=backButton_height, bg="white", borderwidth=0, font=('Helvetica', '15'), command=backpage, cursor="hand2") back_button.place(x=50, y=50) toprightmostpart() except: log_except()
def homemiddlepart(user): try: global canvas5, report_image,image2, canvas4, canvas1, \ login, back, photo_image6, reportGameGraph, canvas2,doctor_img,canvas_img,photo_image3 # back.append(1) if canvas_img is not None: canvas_img.config(height=0, width=0) canvas_img.delete("all") if canvas1 is not None: canvas1.config(height=0, width=0) canvas1.delete("all") if canvas5 is not None: canvas5.config(height=0, width=0) canvas5.delete("all") if canvas4 is not None: canvas4.config(height=0, width=0) canvas4.delete("all") if canvas2 is not None: canvas2.config(height=0, width=0) canvas2.delete("all") if canvas is not None: canvas.destroy() login = 1 canvas1 = Canvas(root, bg="white", width=root.winfo_screenwidth(), height=20, highlightbackground="black", highlightthickness=5) canvas1.place(x=0, y=0) canvas1.create_text(root.winfo_screenwidth() / 2, 15, fill="black", font="Times 12 italic bold", text="Home") canvas2 = Canvas(root, bg="white", width=root.winfo_screenwidth() - 40, height=root.winfo_screenheight() - 165, highlightbackground="blue", highlightthickness=20) canvas2.place(x=0, y=30) # # # Images canvas2.create_image(150, 100, image=photo_image3) # # canvas_img = Canvas(root, bg="white", width=root.winfo_screenwidth() - 0.5, # height=root.winfo_screenheight() - 105, # highlightbackground="white", highlightthickness=0) # canvas_img.place(x=0, y=30) # canvas_img.create_image(600, 200, image=canvas_home_bg) # canvas2 = Canvas(root, width=250, height=200) # canvas2.place(x=10, y=30) # image3 = Image.open("Pictures/company_logo.jpg") # image3 = image3.resize((150, 100), Image.ANTIALIAS) # # photo_image3 = ImageTk.PhotoImage(image3) # canvas2.create_image(128, 100, image=photo_image3) canvas_img = Canvas(root, bg="white", width=root.winfo_screenwidth() * 0.975, height=root.winfo_screenheight() * 0.790, highlightbackground="white", highlightthickness=0) canvas_img.place(x=root.winfo_screenwidth() * 0.013, y=root.winfo_screenheight() * 0.065) canvas_img.create_image(root.winfo_screenwidth() * 0.5, root.winfo_screenheight() * 0.42, image=canvas_Albg) canvas_img.create_image(150, 100, image=photo_image3) canvas4 = Canvas(root, width=230, height=100, bg='white', highlightthickness=0 ) # highlightbackground="black",highlightthickness=5) canvas4.place(x=root.winfo_screenwidth() - 270, y=50) canvas4.create_text(80, 25, fill="black", font="Times 14 bold", text="Login : "******"blue", font="Times 14 bold ", text=str(user).title()) image6 = Image.open("Pictures/signout.png") image6 = image6.resize((30, 30), Image.ANTIALIAS) photo_image6 = ImageTk.PhotoImage(image6) button1 = HoverButton(canvas4, compound=TOP, bg="black", image=photo_image6, borderwidth=0, command=loginPage) button1.place(x=120, y=50) canvas5 = Canvas(root, bg="white", width=1000, height=350, bd=0, relief='ridge', highlightthickness=0) canvas5.place(x=250, y=265) canvas5.create_text(250, 100, fill="black", font="Times 20 italic bold", text="Ship Registration") canvas5.create_text(530, 100, fill="black", font="Times 20 italic bold", text="Ship Details") canvas5.create_text(830, 100, fill="black", font="Times 20 italic bold", text="Import Questionaries") report_img = HoverButton( canvas5, compound=TOP, width=170, height=170, bg="white", image=doctor_image, borderwidth=0, cursor="hand2", activebackground="white", command=registration) # command=lambda:runreport() report_img.place(x=170, y=140) # x=790, y=140 doctor_img = HoverButton(canvas5, compound=TOP, width=170, height=170, bg="white", image=report_image, borderwidth=0, cursor="hand2", activebackground="white", command=lambda: records()) # command=records, doctor_img.place(x=440, y=140) button = HoverButton( canvas5, compound=TOP, width=170, height=170, bg="white", image=import_ques, borderwidth=0, cursor="hand2", activebackground="white", command=lambda: QuestionImport()) # command=records, button.place(x=740, y=140) # button = tk.Button(canvas5, text='Upload Questions', command= lambda :QuestionImport()) # button.place(x=740, y=140) # # command=records, # ======================== doctor_img.config(state="disabled", cursor="wait") except: log_except()
def loginPage(): try: global canvas5, username, canvas_img, reportGameGraph, password, entry1, entry2, font_size, canvas1, login, back, canvas2, photo_image9, roll, numberChoosen1, canvas2, photo_image2, photo_image3 back.append(5) if canvas1 is not None: canvas1.config(height=0, width=0) canvas1.delete("all") if canvas4 is not None: canvas4.config(height=0, width=0) canvas4.delete("all") if canvas5 is not None: canvas5.config(height=0, width=0) canvas5.delete("all") if canvas2 is not None: canvas2.config(height=0, width=0) canvas2.delete("all") if canvas is not None: canvas.destroy() if entry3 is not None: entry3.destroy() login = 0 username = StringVar() password = StringVar() canvas1 = Canvas(root, bg="white", width=root.winfo_screenwidth(), height=20, highlightbackground="black", highlightthickness=5) canvas1.place(x=0, y=0) canvas1.create_text(root.winfo_screenwidth() / 2, 15, fill="black", font="Times 12 italic bold", text="Login") # canvas2 = Canvas(root, bg="white", width=root.winfo_screenwidth() - 40, height=root.winfo_screenheight() - 165, # highlightbackground="blue", highlightthickness=20) # canvas2.place(x=0, y=30) # Images # photo_image2 = ImageTk.PhotoImage(image2) # canvas2.create_image(150, 100, image=photo_image2) # photo_image3 = ImageTk.PhotoImage(image3) canvas_img = Canvas(root, bg="white", width=root.winfo_screenwidth() - 0.5, height=root.winfo_screenheight() - 105, highlightbackground="white", highlightthickness=0) canvas_img.place(x=0, y=30) canvas_img.create_image(550, 100, image=canvas_bg) canvas2 = Canvas(root, width=250, height=200) canvas2.place(x=0, y=30) image3 = Image.open("Pictures/company_logo.jpg") image3 = image3.resize((260, 210), Image.ANTIALIAS) photo_image3 = ImageTk.PhotoImage(image3) canvas2.create_image(128, 100, image=photo_image3) canvas5 = Canvas( root, bg="white", width=550, height=350, bd=0, relief='ridge', highlightthickness=0 ) # , highlightbackground="black", highlightthickness=5) canvas5.place(x=400, y=210) # int(root.winfo_screenheight()/2)), canvas5.create_text(310, 40, fill="black", font="Times 25 italic bold", text="Maritime Doctor Admin Login") canvas5.create_text(150, 120, fill="black", font="Times 20 italic bold", text="Username : "******"black", font="Times 20 italic bold", text="Password : "******"*", textvariable=password, bd=3, width=20, font=font_size) entry2.place(x=250, y=180) entry2.delete(0, END) button1 = HoverButton(canvas5, text="Login", bg="#007ED9", fg="white", font=('Helvetica', '15'), width=15, activebackground='blue', command=checkLogIn, cursor="hand2") # command=checkLogIn, button1.place(x=250, y=250) # canvas5.create_text(410, 300, fill="black", font="Times 10 italic bold", text="New user? Create an account. ") # if db._userCount(): # link1=Label(canvas5,text="New user? Create an account. ",fg="blue",bg="white",cursor="hand2") # link1.place(x=250,y=300) # link1.bind("<Button-1>",lambda e:registration()) canvas3 = Canvas(root, bg="white", width=root.winfo_screenwidth(), height=20, highlightbackground="black", highlightthickness=5) canvas3.place(x=0, y=root.winfo_screenheight() - 95) canvas3.create_text(root.winfo_screenwidth() / 2, 15, fill="black", font="Times 10 italic bold", text="2019 © Admin - Maritime Doctor") # button2 = HoverButton(canvas5, text="Register", bg="#007ED9", fg="white", font=('Helvetica', '15'), # command=lambda:registration(), width=15, activebackground='blue', cursor="hand2") # button2.place(x=320, y=250) # toprightmostpart() except: log_except()