def addUser(username, password1, password2, window): #Clears all the leading and trailing whitespace username = username.strip() password1 = password1.strip() password2 = password2.strip() #Ensures all the fields have been completed if username == "" or password1 == "" or password2 == "": print("Complete all fields") else: #Ensures the user does not already exist if checkForExistingUser(username): print("User already exists") else: #Ensures both passwords match if password1 != password2: print("Passwords do not match") else: #Inserts the user into the database mycursor.execute("INSERT INTO users VALUES (%s, %s)", (username, password1)) mydb.commit() #Makes the entry permanent HomePage.displayUI(window, username, False) #Takes the user to the homepage
def login(username, password, window): #Clears all the leading and trailing whitespace username = username.strip() password = password.strip() #Ensures all the fields have been completed if username == "" or password == "": print("Complete all fields") else: #Ensures the user exists in the database if not checkForExistingUser(username): print("User does not exist") #Logs the user in else: #Fetches the password for the specified user mycursor.execute("SELECT password FROM users WHERE username = %s", (username, )) #Stores the password from the database dbPassword = mycursor.fetchall()[0][0] if dbPassword == password: print("Success") #Displays the homepage for the user HomePage.displayUI(window, username, False) else: print("Password wrong")
def submit(origin): usrname = name.get() email = uname.get() password = passwd.get() password2 = passwd_re.get() if (usrname == ""): l = Label(origin, text="Enter a Name", font="Arial 14", bg='white', fg='red') l.place(x=230, y=455) elif (password == ""): l = Label(origin, text="Enter Password\t", font="Arial 14", bg='white', fg='red') l.place(x=230, y=455) elif (email == ""): l = Label(origin, text="Enter valid Email-Id", font="Arial 14", bg='white', fg='red') l.place(x=230, y=455) elif (password == ""): l = Label(origin, text="Retype Password\t", font="Arial 14", bg='white', fg='red') l.place(x=230, y=455) elif (password2 == ""): l = Label(origin, text="Retype Password\t", font="Arial 14", bg='white', fg='red') l.place(x=230, y=455) elif (password != password2): l = Label(origin, text="Passwords Mismatch", font="Arial 14", bg='white', fg='red') l.place(x=230, y=455) else: l = Label(origin, text="\t\t", font="Arial 14", bg='white', fg='red') l.place(x=230, y=455) boo = f.register_data(usrname, email, password) if boo == 1: HomePage.frontpage(origin)
def submit(origin): usrname = uname.get() password = passwd.get() if(usrname == ""): l = Label(origin,text = "Enter valid Email-Id",font = "Arial 14",bg= 'white',fg = 'red') l.place(x = 230 , y = 470) elif(password == ""): l = Label(origin,text = "Enter Password\t",font = "Arial 14",bg = 'white',fg = 'red') l.place(x = 230 , y = 470) else: l = Label(origin,text = "\t\t\t",font = "Arial 14",bg = 'white',fg = 'red') l.place(x = 230 , y = 470) boo = f.signin_data(usrname,password) if boo == 1: HomePage.frontpage(origin)
def test_login(self): homepage = HomePage.HomePage(self.driver) homepage.click_on_account() homepage.login() signinpage = SignInPage.SignInPage(self.driver) signinpage.sign_in() playvideo = PlayVideo.PlayVideo(self.driver) playvideo.play_video() homepage = HomePage.HomePage(self.driver) homepage.click_on_account() logout = LogOutPage.LogOutPage(self.driver) logout.log_out()
def home_page(self): if self.email.get() == "" or self.password.get() == "": messagebox.showerror("Error", "All fields are required", parent=page) elif self.login_confirmation == False: messagebox.showerror("Error", "Invalid Email/Password", parent=page) else: messagebox.showinfo("Welcome", "Welcome to Mr.Doctor", parent=page) home_page = Home.DoctorHomePage(self.doctor_id) Frame_login.destroy()
def update(self): self.MainFrame.update() self.CurrentPage.update() #print("Email: {}; Password: {}".format(self.account_name.get(), self.account_password.get())); if (self.CurrentPage.switch()): self.CurrentPage.destroy() if (self.CurrentPage.next_page_id == "HP"): self.CurrentPage = HomePage.HomePage(self.MainFrame, self.account_name, self.account_password) elif (self.CurrentPage.next_page_id == "FP"): self.CurrentPage = FunctionPage.FunctionPage( self.MainFrame, self.account_name, self.account_password) #print('GUI Refresh'); self.Root.after(250, self.update)
def submit_patient(self): # Get Value from the Entries name = self.first_name.get() + " " + self.last_name.get() age = int(self.age.get()) email = self.email.get() password = self.password.get() if self.first_name.get() == "" or self.last_name.get( ) == "" or age == "" or email == "" or password == "": messagebox.showerror("Error", "All fields are required", parent=page) else: # Connect with Database dbConnect = db.dbConnect() self.submit_confirmation = dbConnect.insertData_patient( name, age, email, password) self.home_page() home_page = Home.PatientHomePage() Frame_signup.destroy()
def handle(self, *args, **options): if Site.objects.count() > 1: return if Page.objects.count() > 2: return site = Site.objects.first() if site.root_page.specific.__class__.__name__ != Page.__name__: return root_page = Page.objects.filter(depth=1).first() new_site_page = HomePage(title="Home Page", slug="home-page") root_page.add_child(instance=new_site_page) old_site_page = site.root_page site.root_page = new_site_page site.save() old_site_page.delete() self.stdout.write("Default site root page was changed")
def submit(self, list): # Get Value from the Entries name = self.name.get() designation = self.designation.get() email = self.email.get() password = self.password.get() dayList = [] for i in list.curselection(): day = list.get(i) dayList.append(day) if name == "" or designation == "" or email == "" or password == "": messagebox.showerror("Error", "All fields are required", parent=page) else: # Connect with Database dbConnect = db.dbConnect() self.submit_confirmation = dbConnect.insertData_doctor( name, designation, email, password, dayList) self.home_page() home_page = Home.DoctorHomePage(self.submit_confirmation) Frame_signup.destroy()
con.close() def get3RandomFlights(self): import random con = sqlite3.connect('ticketair.db') cur = con.cursor() cur.execute('SELECT COUNT(*) FROM flights') flightCount = cur.fetchone()[0] flightsN = random.sample(range(1, flightCount + 1), 3) flights = [] for n in flightsN: cur.execute(f'SELECT * FROM flights LIMIT {n-1},1') origin, destination, flightNumber, tailNumber, date, price, time, capacity, sold = cur.fetchone( ) flights.append( Flight(origin, destination, flightNumber, tailNumber, date, price, time, sold)) return flights if __name__ == '__main__': db = DataBase() db.create_tables() app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() ui = HomePage.Ui_MainWindow() ui.setupUi(MainWindow) ui.setOrigins() ui.callThisFunctionEvery15Secs() MainWindow.show() sys.exit(app.exec_())
def GoBack(root): HomePage.Page(root)
import os, csv, sys from MyInvoiceHandler import MyInvoiceHandler import HomePage import EndPage number = 1 # Keeps track of which number file the program is on for naming purposes def resource_path(relative): # Method to find absolute path of given resource return os.path.join(os.environ.get("_MEIPASS2", os.path.abspath(".")), relative) page1 = HomePage.HomePage() # Creates an instance of the home page page1.make_window() # Displays the homepage if page1.get_paths() != 0: for filename in page1.get_paths(): final_product = MyInvoiceHandler( ) # Creates an instance of the invoice handler if filename.endswith(".csv"): invoice_file = str(filename) inc_cols = [2, 14, 15, 47, 46, 56] # Only provides relevant columns from the CSV file with open(filename, newline='') as textfile:
def fazer_login(self, usuario, senha): utilidades.logar(self.browser, usuario, senha) return HomePage(self.browser, self.baseUrl)
def create_register(root): import Createnew root.destroy() origin = Tk() screen_width = origin.winfo_screenwidth() screen_height = origin.winfo_screenheight() #root.attributes('-fullscreen',True) origin.minsize(width=screen_width, height=screen_height) origin.config(bg="White") origin.title("Bon Voyage") gg = '#134e86' g = "#0a2845#" gw = "white" path = "res/logoc.png" img = ImageTk.PhotoImage(Image.open(path)) panel = Label(origin, image=img, background="white") panel.place(x=0, y=0) tk_rgb = "#%02x%02x%02x" % (32, 48, 60) lb_rgb = "#%02x%02x%02x" % (133, 143, 150) lab_login = Label(origin, text="Sign Up", background="white", font="Arial 42", foreground=tk_rgb) lab_login.place(x=630, y=50) lab_newuser = Label(origin, text="Already a Bon Voyage user?", background="white", font="Arial 15", foreground=tk_rgb) lab_newuser.place(x=570, y=120) b4 = Button(origin, text="Log in.", padx=20, pady=10, bd=0, bg="white", fg="white", font="Arial 15", relief=RAISED, overrelief=RIDGE, command=lambda: L.create_login(origin)) img5 = PhotoImage(file="res/login1.png") b4.config(image=img5) b4.place(x=825, y=124) lab_name = Label(origin, text="Name : ", background="white", font="Arial 20", foreground=tk_rgb) lab_name.place(x=230, y=210) global name name = Entry(origin, font="Arial 18") name.place(x=375, y=215, width=250) lab_username = Label(origin, text="Email : ", background="white", font="Arial 20", foreground=tk_rgb) lab_username.place(x=230, y=260) global uname uname = Entry(origin, font="Arial 18") uname.place(x=375, y=265, width=250) lab_passwd = Label(origin, text="Password : "******"white", font="Arial 20", foreground=tk_rgb) lab_passwd.place(x=228, y=318) global passwd passwd = Entry(origin, font="Arial 16", show="*") passwd.place(x=375, y=321, width=250) lab_passwd_re = Label(origin, text="Retype\nPassword : "******"white", font="Arial 20", foreground=tk_rgb) lab_passwd_re.place(x=228, y=370) global passwd_re passwd_re = Entry(origin, font="Arial 16", show="*") passwd_re.place(x=375, y=390, width=250) path1 = "res/separator.jpg" img1 = ImageTk.PhotoImage(Image.open(path1)) panel1 = Label(origin, image=img1) panel1.place(x=700, y=205, width=1, height=330) sign_up = Button(origin, text="Sign Up", padx=20, pady=10, bd=0, bg="white", fg="white", font="Arial 14 bold", relief=RAISED, overrelief=RIDGE, command=lambda: submit(origin)) image7 = PhotoImage(file="res/sign_up1.png", ) sign_up.config(image=image7) sign_up.place(x=400, y=490) home_but = Button(origin, text="Home", padx=20, pady=10, bd=0, bg="white", fg="white", relief=RAISED, overrelief=RIDGE, command=lambda: HomePage.frontpage(origin)) img_home = PhotoImage(file="res/home_login.png") home_but.config(image=img_home) home_but.place(x=screen_width - 80, y=10) b2 = Button(origin, text="Facebook", padx=20, pady=10, bd=0, bg="white", fg="white", font="Arial 14 bold", relief=RAISED, overrelief=RIDGE, command=Createnew.create_window) img2 = PhotoImage(file="res/fbutton.png") b2.config(image=img2) b2.place(x=830, y=285) b3 = Button(origin, text="Google", padx=20, pady=10, bd=0, bg="white", fg="white", font="Arial 14 bold", relief=RAISED, overrelief=RIDGE, command=Createnew.create_window) img3 = PhotoImage(file="res/gbutton.png") b3.config(image=img3) b3.place(x=830, y=360) lab_conditions1 = Label( origin, text= "* By signing up, you agree to our Terms of Use ,Privacy \nPolicy and to receive emails, newsletters & updates from Bon Voyage", background="white", font="Arial 11", foreground=lb_rgb) lab_conditions1.place(x=550, y=590) origin.mainloop()
def Succes(r): HomePage.Page(r)
def create_login(origin): from PIL import ImageTk, Image import Createnew from HomePage import frontpage origin.destroy() origin = Tk() #origin = Frame(origin,) origin.title("Bon Voyage") screen_width = origin.winfo_screenwidth() screen_height = origin.winfo_screenheight() #origin.attributes('-fullscreen',True) origin.minsize(width=screen_width, height=screen_height) origin.config(bg="White") gg='#134e86' g="#0a2845#" gw="white" path = "res/logoc.png" img = ImageTk.PhotoImage(Image.open(path)) panel = Label(origin, image=img,background="white") panel.place(x=0,y=0) tk_rgb = "#%02x%02x%02x" % (32,48,60) lb_rgb = "#%02x%02x%02x" % (133,143,150) lab_login = Label(origin,text="Log In",background="white",font = "Arial 42",foreground=tk_rgb) lab_login.place(x=630,y=100) lab_newuser = Label(origin,text="New to Bon Voyage? ",background="white",font = "Arial 15",foreground=tk_rgb) lab_newuser.place(x=570,y=170) lab_signup = Label(origin,text="Sign Up.",background="white",font = "Arial 15",foreground=tk_rgb) lab_signup.place(x=760,y=170) b4 = Button(origin,text="Sign Up",padx=20,pady=10,bd=0,bg="white",fg="white",font="Arial 15",relief=RAISED,overrelief=RIDGE,command=lambda:create_register(origin)) img5 = PhotoImage(file = "res/signup.png") b4.config(image=img5) b4.place(x=760,y=170) home_but = Button(origin,text = "Home",padx=20,pady=10,bd=0,bg="white",fg="white",relief=RAISED,overrelief=RIDGE,command=lambda:HomePage.frontpage(origin)) img_home = PhotoImage(file = "res/home_login.png") home_but.config(image=img_home) home_but.place(x=screen_width-80,y=10) lab_username = Label(origin,text="Email : ",background="white",font = "Arial 20",foreground=tk_rgb) lab_username.place(x=230,y=310) global uname uname = Entry(origin,font="Arial 18") uname.place(x=375,y=315,width=250) lab_passwd = Label(origin,text="Password : "******"white",font = "Arial 20",foreground=tk_rgb) lab_passwd.place(x=230,y=371) global passwd passwd = Entry(origin,font="Arial 18",show="*") passwd.place(x=375,y=376,width=250) path1 = "res/separator.jpg" img1 = ImageTk.PhotoImage(Image.open(path1)) panel1 = Label(origin, image = img1) panel1.place(x=700,y=265,width=1,height=280) check_remember=Checkbutton(origin,text="Keep me logged in.",bg="white",font="Arial 14") check_remember.place(x=230,y=430) b1 = Button(origin,text="Sign In",padx=20,pady=10,bd=0,bg="white",fg="white",font="Arial 14 bold",relief=RAISED,overrelief=RIDGE,command = lambda : submit(origin)) image = PhotoImage(file="res/signin2.png",) b1.config(image=image) b1.place(x=380,y=510) b2 = Button(origin,text="Facebook",padx=20,pady=10,bd=0,bg="white",fg="white",font="Arial 14 bold",relief=RAISED,overrelief=RIDGE,command=Createnew.create_window) img2 = PhotoImage(file = "res/fbutton.png") b2.config(image=img2) b2.place(x=830,y=325) b3 = Button(origin,text="Google",padx=20,pady=10,bd=0,bg="white",fg="white",font="Arial 14 bold",relief=RAISED,overrelief=RIDGE,command=Createnew.create_window) img3 = PhotoImage(file = "res/gbutton.png") b3.config(image=img3) b3.place(x=830,y=400) lab_conditions1 = Label(origin,text = "* By signing up, you agree to our Terms of Use ,Privacy \nPolicy and to receive emails, newsletters & updates from Bon Voyage",background="white",font = "Arial 11",foreground=lb_rgb) lab_conditions1.place(x=550,y=590) origin.mainloop()
from HomePage import * from SearchFilterView import * import pytest, re #set up browser for testing browser = webdriver.Chrome("C:/chromedriver/chromedriver.exe") browser.get('http://redfin.com/') browser.set_page_load_timeout(20) home = HomePage(browser) # navigate to home page complete def test_setup(): state = home.browser.execute_script('return document.readyState') print(state) if state == 'complete': assert True else: assert False # Search for city and verify in URL change def test_city(): sleep(3) home.setSearchCityResult('Hillsboro OR') if 'Hillsboro' in home.browser.current_url: assert True # Search based on input 'Hillsboro OR' def test_search():
# -*- coding:utf-8 -*- # @Time : 2020/7/9 20:39 # @Author : AX # @File : test.py # @Software: PyCharm import HomePage if __name__ == '__main__': data = HomePage.request_data_url("http://www.qiyeok.com/") print(data)
def returnHomePage(self): self.page.destroy() HomePage.HomePage(self.root)
def about (origin): origin.destroy() root=Tk() screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() mainframe = Frame(root,width = screen_width,height = screen_height) mainframe.pack() swin = ScrolledWindow(mainframe, width=screen_width, height=screen_height) swin.pack() win = swin.window root.minsize(width=screen_width, height=screen_height) root.config(bg="white") #root.attributes("-fullscreen",True) root.title("Bon Voyage") frame_width = win.winfo_screenwidth() frame_height =2500 back="#FFFFF0" top=Frame(win,width=frame_width,height=60,bg=back) top.pack(side=TOP) f1=Frame(win,width=frame_width/2,height=frame_height-60,bg=back) f1.propagate(0) f1.pack(side=LEFT) f2=Frame(win,width=frame_width/2,height=frame_height-60,bg=back) f1.propagate(0) f2.pack(side=RIGHT) l1=Label(top,text="About",font=("lucida calligraphy",40,"bold"),bg=back,fg="#c25245") l1.place(x=5,y=0) path="res/mal.jpg" photo=ImageTk.PhotoImage(Image.open(path)) lb=Label(f1,image=photo) lb.place(x=70,y=40,width=510,height=350) l2=Label(f2,text="Take only memories..",font=("georgia",30,"bold"),fg="black",bg=back) l2.place(x=0,y=40) l3=Label(f2,text="Leave only footprints!!!",font=("georgia",30,"bold"),fg="black",bg=back) l3.place(x=0,y=80) m1=Message(f2,text="An experience designed to bring us back to our elements, immerse us in the magic of the woods, and challenge us to rediscover.",font=("arial",20),fg="black",bg=back) m1.place(x=0,y=140) l3=Label(f1,text="Every Gateaway is quest for...",font=("georgia",30,"bold"),fg="black",bg=back) l3.place(x=70,y=400) #------------------------------------ b5=Button(f1,command=lambda:HomePage.frontpage(root)) b5.config(text="Return to Home",font=("georgia",18),bg="red") b5.place(x=130,y=1750,width=200,height=50) l3=Label(f1,text="Balance",font=("georgia",30,"bold"),fg="#c25245",bg=back) l3.place(x=120,y=560) m2=Message(f1,text="Making cities, technology and work even better through nature, disconnection and rest",font=("arial",20),fg="black",bg=back) m2.place(x=120,y=620) path1="res/balance.jpg" photo1=ImageTk.PhotoImage(Image.open(path1)) lb=Label(f2,image=photo1) lb.place(x=0,y=490,width=510,height=350) #-------------------------------------- l3=Label(f2,text="Ritual",font=("georgia",30,"bold"),fg="#c25245",bg=back) l3.place(x=70,y=950) m3=Message(f2,text="Creating the time and space you need to explore, appreciate and wonder ",font=("arial",20),fg="black",bg=back) m3.place(x=70,y=1000) path2="res/ritual.png" photo2=ImageTk.PhotoImage(Image.open(path2)) lb=Label(f1,image=photo2) lb.place(x=70,y=900,width=510,height=350) #----------------------------------------- l3=Label(f1,text="Leisure",font=("georgia",30,"bold"),fg="#c25245",bg=back) l3.place(x=120,y=1380) m3=Message(f1,text="Marrying the curiosity of a pioneer with the humility of a houseguest",font=("arial",20),fg="black",bg=back) m3.place(x=120,y=1430) path3="res/leisure.png" photo3=ImageTk.PhotoImage(Image.open(path3)) lb=Label(f2,image=photo3) lb.place(x=0,y=1320,width=510,height=350) #-------------------------------------- #--------NEXT------------------ root.mainloop()
def ir_para_pagina_principal(self): utilidades.acessar(self.browser, self.baseUrl) return HomePage(self.browser, self.baseUrl)
def returnHomePage(self): self.page.pack_forget() HomePage.HomePage(self.root)
def homepage(self): other = Tk() ob = HomePage.Home(other) other.title('Crop management System Homepage') other.geometry('500x500') other.mainloop()
def run(): x = HomePage.HomePage() name = x.name play(name)
# project: Data scraping Interface Design # Author: Zihe Han # Date: Semester 2, 2019 from tkinter import * from HomePage import * root = Tk() root.title('Data scraping program') HomePage(root) root.mainloop()
def maldives_flight(origin): origin.destroy() root = Tk() screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() mainframe = Frame(root, width=screen_width, height=screen_height) mainframe.pack() swin = ScrolledWindow(mainframe, width=screen_width, height=screen_height) swin.pack() win = swin.window root.minsize(width=screen_width, height=screen_height) root.config(bg="white") #root.attributes("-fullscreen",True) root.title("Bon Voyage") frame_width = win.winfo_screenwidth() frame_height = 1400 top = Frame(win, width=frame_width, height=100, bg="white") top.pack(side=TOP) f1 = Frame(win, width=frame_width / 2, height=frame_height - 60, bg="white") f1.propagate(0) f1.pack(side=LEFT) f2 = Frame(win, width=frame_width / 2, height=frame_height - 60, bg="white") f1.propagate(0) f2.pack(side=RIGHT) #-----------HOME BUTTON----------------------------------------------- b = Button(top, command=lambda: HomePage.frontpage(root)) img = PhotoImage(file="res/home_login.png") b.config(image=img, width="60", height="80", bg="white", bd=0) b.place(x=screen_width - 110, y=5) lb = Label(top, text="MALDIVES", font=("lucida calligraphy", 40, "bold"), fg="#4EB1BA", bg="white") lb.place(x=470, y=0) lb = Label(top, text="FLIGHTS+HOTELS", font=("lucida calligraphy", 28, "bold"), fg="#b20000", bg="white") lb.place(x=70, y=60) path = "res/f1.jpg" photo = ImageTk.PhotoImage(Image.open(path)) lb = Label(f1, image=photo) lb.place(x=70, y=40, width=510, height=250) l1 = Label(f2, text="Emirates+The Grand Royale", font=("arial", 30, "bold"), fg="black", bg="white") l1.place(x=0, y=40) l1 = Label(f2, text="Before Discount :", font=("arial", 20, "bold"), fg="blue", bg="white") l1.place(x=0, y=90) l2 = Label(f2, text="Rs.40000", font=("arial", 20, "overstrike"), fg="red", bg="white") l2.place(x=235, y=90) l2 = Label(f2, text="After Discount :", font=("arial", 20, "bold"), fg="blue", bg="white") l2.place(x=0, y=120) l2 = Label(f2, text="Rs.31000", font=("arial", 20, "bold"), fg="green", bg="white") l2.place(x=210, y=120) t1 = Message( f2, text="Posh riverside lodging with chic rooms and a hip BBQ restaurant.", font=("arial", 20), fg="black", bg="white", width=400) t1.place(x=0, y=160) b1 = Button(f2, text="BOOK", padx=20, pady=10, bd=5, bg="blue", fg="white", command=lambda: main(root, "The Grand Royale")) b1.place(x=9, y=240) path2 = "res/f3.jpg" photo2 = ImageTk.PhotoImage(Image.open(path2)) lb2 = Label(f1, image=photo2) lb2.place(x=70, y=320, width=510, height=250) l3 = Label(f2, text="Spicejet+Paradise Resort", font=("arial", 30, "bold"), fg="black", bg="white") l3.place(x=0, y=320) l4 = Label(f2, text="Before Discount :", font=("arial", 20, "bold"), fg="blue", bg="white") l4.place(x=0, y=370) l4 = Label(f2, text="Rs.55000", font=("arial", 20, "overstrike"), fg="red", bg="white") l4.place(x=235, y=370) l4 = Label(f2, text="After Discount :", font=("arial", 20, "bold"), fg="blue", bg="white") l4.place(x=0, y=400) l4 = Label(f2, text="Rs.45000", font=("arial", 20, "bold"), fg="green", bg="white") l4.place(x=210, y=400) t1 = Message( f2, text="Beautiful beaches with good view and exotic rooms best.", font=("arial", 20), fg="black", bg="white", width=400) t1.place(x=0, y=440) b1 = Button(f2, text="BOOK", padx=20, pady=10, bd=5, bg="blue", fg="white", command=lambda: main(root, "Paradise Resort")) b1.place(x=9, y=520) path4 = "res/jet.png" photo4 = ImageTk.PhotoImage(Image.open(path4)) lb4 = Label(f1, image=photo4) lb4.place(x=70, y=600, width=510, height=250) l5 = Label(f2, text="Jet Airways+The Baros Maldives", font=("arial", 30, "bold"), fg="black", bg="white") l5.place(x=0, y=600) l5 = Label(f2, text="Before Discount :", font=("arial", 20, "bold"), fg="blue", bg="white") l5.place(x=0, y=650) l5 = Label(f2, text="Rs.45000", font=("arial", 20, "overstrike"), fg="red", bg="white") l5.place(x=235, y=650) l5 = Label(f2, text="After Discount : ", font=("arial", 20, "bold"), fg="blue", bg="white") l5.place(x=0, y=680) l5 = Label(f2, text="Rs.30000", font=("arial", 20, "bold"), fg="green", bg="white") l5.place(x=210, y=680) t2 = Message( f2, text="Beautiful beaches with good view and exotic rooms best.", font=("arial", 20), fg="black", bg="white", width=400) t2.place(x=0, y=720) b2 = Button(f2, text="BOOK", padx=20, pady=10, bd=5, bg="blue", fg="white", command=lambda: main(root, "The Baros Maldives")) b2.place(x=9, y=800) path6 = "res/indigo.jpg" photo6 = ImageTk.PhotoImage(Image.open(path6)) lb6 = Label(f1, image=photo6) lb6.place(x=70, y=880, width=510, height=250) l7 = Label(f2, text="Indigo+The Grand Royale", font=("arial", 30, "bold"), fg="black", bg="white") l7.place(x=0, y=880) l8 = Label(f2, text="Before Discount :", font=("arial", 20, "bold"), fg="blue", bg="white") l8.place(x=9, y=930) l8 = Label(f2, text="Rs.21000", font=("arial", 20, "overstrike"), fg="red", bg="white") l8.place(x=235, y=930) l8 = Label(f2, text="After Discount :", font=("arial", 20, "bold"), fg="blue", bg="white") l8.place(x=9, y=960) l8 = Label(f2, text="Rs.15000", font=("arial", 20, "bold"), fg="green", bg="white") l8.place(x=210, y=960) t3 = Message(f2, text="Natural view with good atmosphere and exotic rooms.", font=("arial", 20), fg="black", bg="white", width=400) t3.place(x=0, y=1000) b3 = Button(f2, text="BOOK", padx=20, pady=10, bd=5, bg="blue", fg="white", command=lambda: main(root, "The Grand Royale")) b3.place(x=9, y=1080) root.mainloop()
usage: 通过搜索结果页面的logo元素,来判断是否跳转到搜索页面 return: 存在logo返回true,否则返回false """ try: self.find_element(BaobeiPage.logo) return True except TimeoutError as e: print("error:%s" % e.args) return False def get_not_exist_hint(self): flag = self.find_element(BaobeiPage.not_exist_flag) return flag.get_attribute('innerHTML') if __name__ == "__main__": driver = webdriver.Firefox() homedriver = HomePage(driver) homedriver.open("https://www.taobao.com/") itemdriver = BaobeiPage(driver) homedriver.item_search("羽绒服") it = itemdriver.get_search_text() print(it) itemdriver.go_back() homedriver.item_search('keijewihr') item = itemdriver.find_element(BaobeiPage.not_exist_flag) print(item.get_attribute('innerHTML'))
def ukpage(home_root): home_root.destroy() root=Tk() screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() mainframe = Frame(root,width = screen_width,height = screen_height) mainframe.pack() swin = ScrolledWindow(mainframe, width=screen_width, height=screen_height) swin.pack() win = swin.window root.minsize(width=screen_width, height=screen_height) root.config(bg="white") #root.attributes("-fullscreen",True) frame_width = win.winfo_screenwidth() frame_height = 1600 top=Frame(win,width=frame_width,height=60,bg="white") top.pack(side=TOP) f1=Frame(win,width=frame_width/2,height=frame_height-60,bg="white") f1.propagate(0) f1.pack(side=LEFT) f2=Frame(win,width=frame_width/2,height=frame_height-60,bg="white") f1.propagate(0) f2.pack(side=RIGHT) #-----------HOME BUTTON----------------------------------------------- b=Button(top,command=lambda:HomePage.frontpage(root)) img=PhotoImage(file="res/home_login.png") b.config(image=img,width="60",height="50",bg="white",bd = 0) b.place(x=screen_width-80,y=10) lb=Label(top,text="UK",font=("lucida calligraphy",40,"bold"),fg="#4EB1BA",bg="white") lb.place(x=580,y=0) lb=Label(top,text="Come Explore Your Dreams",font=("arial",15,"bold"),fg="blue",bg="white") lb.place(x=470,y=70) path="res/uk1.jpg" photo=ImageTk.PhotoImage(Image.open(path)) lb=Label(f1,image=photo) lb.place(x=70,y=40,width=510,height=250) l1=Label(f2,text="The Crown Lodge Hotel",font=("arial",30,"bold"),fg="black",bg="white") l1.place(x=0,y=40) path1="res/star.png" photo1=ImageTk.PhotoImage(Image.open(path1)) lb1=Label(f2,image=photo1,bg="white") lb1.place(x=0,y=80,width=200,height=50) l2=Label(f2,text="Rs.21000",font=("arial",20,"bold"),fg="blue",bg="white") l2.place(x=9,y=120) t1=Message(f2,text="Posh riverside lodging with chic rooms and a hip BBQ restaurant.",font=("arial",20),fg="black",bg="white",width = 400) t1.place(x=0,y=160) b1=Button(f2,text="BOOK",padx=20,pady=10,bd=5,bg="blue",fg="white",command = lambda : main(root,"The Crown Lodge Hotel")) b1.place(x=9,y=240) path2="res/uk2.jpg" photo2=ImageTk.PhotoImage(Image.open(path2)) lb2=Label(f1,image=photo2) lb2.place(x=70,y=320,width=510,height=250) l3=Label(f2,text="The George",font=("arial",30,"bold"),fg="black",bg="white") l3.place(x=0,y=320) path3="res/star.png" photo3=ImageTk.PhotoImage(Image.open(path3)) lb3=Label(f2,image=photo3,bg="white") lb3.place(x=0,y=360,width=200,height=50) l4=Label(f2,text="Rs.35000",font=("arial",20,"bold"),fg="blue",bg="white") l4.place(x=9,y=400) t1=Message(f2,text="Beautiful beaches with good view and exotic rooms best.",font=("arial",20),fg="black",bg="white",width = 400) t1.place(x=0,y=440) b1=Button(f2,text="BOOK",padx=20,pady=10,bd=5,bg="blue",fg="white",command = lambda : main(root,"The George")) b1.place(x=9,y=520) path4="res/uk3.jpg" photo4=ImageTk.PhotoImage(Image.open(path4)) lb4=Label(f1,image=photo4) lb4.place(x=70,y=600,width=510,height=250) l5=Label(f2,text="The Milestone Hotel ",font=("arial",30,"bold"),fg="black",bg="white") l5.place(x=0,y=600) path5="res/star.png" photo5=ImageTk.PhotoImage(Image.open(path5)) lb5=Label(f2,image=photo5,bg="white") lb5.place(x=0,y=640,width=200,height=50) l5=Label(f2,text="Rs.45000",font=("arial",20,"bold"),fg="blue",bg="white") l5.place(x=9,y=680) t2=Message(f2,text="Beautiful beaches with good view and exotic rooms best.",font=("arial",20),fg="black",bg="white",width = 400) t2.place(x=0,y=720) b2=Button(f2,text="BOOK",padx=20,pady=10,bd=5,bg="blue",fg="white",command = lambda : main(root,"The Milestone Hotel ")) b2.place(x=9,y=800) path6="res/uk4.jpg" photo6=ImageTk.PhotoImage(Image.open(path6)) lb6=Label(f1,image=photo6) lb6.place(x=70,y=880,width=510,height=250) l7=Label(f2,text="The Montauge on gardens",font=("arial",30,"bold"),fg="black",bg="white") l7.place(x=0,y=880) path7="res/star.png" photo7=ImageTk.PhotoImage(Image.open(path7)) lb7=Label(f2,image=photo5,bg="white") lb7.place(x=0,y=920,width=200,height=50) l8=Label(f2,text="Rs.40000",font=("arial",20,"bold"),fg="blue",bg="white") l8.place(x=9,y=960) t3=Message(f2,text="Natural view with good atmosphere and exotic rooms.",font=("arial",20),fg="black",bg="white",width = 400) t3.place(x=0,y=1000) b3=Button(f2,text="BOOK",padx=20,pady=10,bd=5,bg="blue",fg="white",command = lambda : main(root,"The Montauge on gardens")) b3.place(x=9,y=1080) path8="res/uk6.jpg" photo8=ImageTk.PhotoImage(Image.open(path8)) lb8=Label(f1,image=photo8) lb8.place(x=70,y=1160,width=510,height=250) l9=Label(f2,text="Draycott Hotel",font=("arial",30,"bold"),fg="black",bg="white") l9.place(x=0,y=1160) path9="res/star.png" photo9=ImageTk.PhotoImage(Image.open(path9)) lb9=Label(f2,image=photo5,bg="white") lb9.place(x=0,y=1200,width=200,height=50) l10=Label(f2,text="Rs.55000",font=("arial",20,"bold"),fg="blue",bg="white") l10.place(x=9,y=1240) t4=Message(f2,text="Natural view with good atmosphere and exotic rooms.",font=("arial",20),fg="black",bg="white",width = 400) t4.place(x=0,y=1280) b4=Button(f2,text="BOOK",padx=20,pady=10,bd=5,bg="blue",fg="white",command = lambda : main(root,"Draycott Hotel")) b4.place(x=9,y=1360) #----------------NEXT----------------- b5=Button(f2,text="NEXT",padx=20,pady=10,bd=5,bg="red",fg="white",command = lambda:uk_flight.uk_flight(root)) b5.place(x=550,y=1420) root.mainloop()
def displayNavbar(self, username): #Splits the window into the two main sections #Sets the frame for the top navbar self.navbar = tk.Frame(self.frame, bd=10, highlightbackground="black", highlightthickness=1) self.navbar.place(relwidth=1, relheight=0.075, relx=0, rely=0) #Adds icons to the top navbar #Button for the icon and navigating back to the homescreen self.icon = tk.Button( self.navbar, text="CS Forum", command=lambda: HomePage.displayUI(self, username, False)) self.icon.place(relx=0, rely=0, relwidth=0.15, relheight=1) #Entry for the searchbar self.searchbar = tk.Entry(self.navbar) self.searchbar.place(relx=0.16, rely=0, relwidth=0.55, relheight=1) #Button to confirm your search self.search = tk.Button( self.navbar, text="Search", command=lambda: HomePage.displayUI(self, username, True, self.searchbar.get())) self.search.place(relx=0.72, rely=0, relwidth=0.1, relheight=1) #Button to take to you to the report page self.report = tk.Button( self.navbar, text="Report", command=lambda: ReportPage.displayUI(self, username)) self.report.place(relx=0.88, rely=0, relwidth=0.05, relheight=1, anchor="ne") #Button to take you to your profile page self.profile = tk.Button( self.navbar, text="Profile", command=lambda: ProfilePage.displayUI(self, username)) self.profile.place(relx=0.94, rely=0, relwidth=0.05, relheight=1, anchor="ne") #Button to bring up your messages self.messages = tk.Button( self.navbar, text="Messages", command=lambda: Messages.displayUI(self, username)) self.messages.place(relx=1, rely=0, relwidth=0.05, relheight=1, anchor="ne")