How to use main_frame method in Playwright Python

Best Python code snippet using playwright-python

main.py

Source:main.py Github

copy

Full Screen

1"""2iContact3Add contact4Search contact5Author: @HomeOfCoding6"""7from tkinter import *8from tkinter import END9from string import capwords10import re11app = Tk()12# ___________________________13# Page Defaults14A12b = 'arial', 12, 'bold'15A12 = 'arial', 1216A10 = 'arial', 1017BG = '#fff'18FG = '#296296'19# ___________________________20# Functions21def search_data():22 textarea.config(fg=FG, state='normal')23 textarea.delete(1.0, END)24 # Getters25 get_search = capwords(search_input.get())26 filename = 'iContacts'27 with open(filename) as f_read:28 for line in f_read:29 if get_search in line:30 textarea.insert(END, line)31 32 search_entry.delete(0, END)33 search_entry.focus()34def submit_data(*args):35 textarea.delete(1.0, END)36 textarea.config(fg=FG)37 # Getters38 get_first = capwords(first_input.get())39 get_last = capwords(last_input.get())40 get_age = capwords(age_input.get())41 get_area = capwords(area_input.get())42 get_email = capwords(email_input.get())43 if get_first == '':44 textarea.config(fg='red', state='normal')45 textarea.insert(1.0, 'Please enter first name *required')46 first_entry.focus()47 first_entry.config(highlightcolor='red')48 elif get_last == '':49 textarea.config(fg='red', state='normal')50 textarea.insert(1.0, 'Please enter last name *required')51 last_entry.focus()52 last_entry.config(highlightcolor='red')53 elif get_age == '':54 textarea.config(fg='red', state='normal')55 textarea.insert(1.0, 'Please enter age *required')56 age_entry.focus()57 age_entry.config(highlightcolor='red')58 elif get_area == '':59 textarea.config(fg='red', state='normal')60 textarea.insert(1.0, 'Please enter location *required')61 area_entry.focus()62 area_entry.config(highlightcolor='red')63 elif get_email == '':64 textarea.config(fg='red', state='normal')65 textarea.insert(1.0, 'Please enter email *required')66 email_entry.focus()67 email_entry.config(highlightcolor='red')68 else:69 # Validate email input here..70 validate_email = get_email71 pattern = re.compile(r"^[a-zA-Z0-9]+([a-zA-Z0-9]+[\.-]"\72 "[a-zA-Z0-9]+)?@([a-zA-Z0-9\d-])"\73 "+\.([a-zA-Z]{2,15})(\.[a-zA-Z]{2,8})?$")74 matches = pattern.search(validate_email)75 # If Email Address is Valid76 if matches:77 textarea.config(fg=FG)78 try:79 # Write to File80 filename = 'iContacts'81 with open(filename, 'a') as f_append:82 f_append.write('Name: ' + get_first + ' ' + get_last + '\n' + \83 get_first + '\'s Age: ' + get_age + '\n' + \84 get_first + '\'s Area: ' + get_area + '\n' + \85 get_first + '\'s Email: ' + get_email + \86 '\n\n---------------------\n\n')87 88 # Show Content on Screen89 textarea.config(fg=FG, state='normal')90 textarea.insert(1.0, 'Data saved successfully!\n\n' + \91 'Name: ' + get_first + ' ' + get_last + '\n' + \92 get_first + '\'s Age: ' + get_age + '\n' + \93 get_first + '\'s Area: ' + get_area + '\n' + \94 get_first + '\'s Email: ' + get_email)95 search_entry.delete(0, END)96 first_entry.delete(0, END)97 last_entry.delete(0, END)98 age_entry.delete(0, END)99 area_entry.delete(0, END)100 email_entry.delete(0, END)101 first_entry.focus()102 except:103 textarea.insert(1.0, 'Sorry!\nData not saved\nPlease try again')104 105 else:106 textarea.insert(1.0, 'Email is not valid')107 textarea.config(fg='red')108 email_entry.focus()109# ___________________________110# Getters111search_input = StringVar()112first_input = StringVar()113last_input = StringVar()114age_input = StringVar()115area_input = StringVar()116email_input = StringVar()117# ___________________________118# Page119# Main Frame (search)120main_frame = Frame(app, bg=BG)121main_frame.pack(ipady=20)122# Search Label123search_label = Label(main_frame, text='Search ', bg=BG, fg=FG, font=A12)124search_label.pack(side='left')125# Search Entry126search_entry = Entry(main_frame, bg=BG, fg=FG, font=A12, \127 highlightcolor=FG, textvariable=search_input)128search_entry.pack(side='left', ipady=1)129# Search Button130search_btn = Button(main_frame, text='GO', bg=FG, fg=BG, font=A10, \131 border=0, relief='flat', command=search_data)132search_btn.pack(side='left')133# ____________________________________________________________________134# Main Frame (separator)135main_frame = Frame(app, bg=FG)136main_frame.pack(fill='x', padx=40, ipady=1)137# ____________________________________________________________________138# ___________________________139# Main Frame (for: add contact label)140main_frame = Frame(app, bg=BG)141main_frame.pack(fill='x', padx=40, ipady=20)142# Add Contact Label143contact_label = Label(main_frame, text='Add Contact', bg=BG, fg=FG, font=A12b)144contact_label.pack(side='left')145# ___________________________146# Main Frame (first name)147main_frame = Frame(app, bg=BG)148main_frame.pack(ipady=2)149# First Name Label150first_label = Label(main_frame, text='First: ', bg=BG, fg=FG, font=A12)151first_label.pack(side='left', padx=(12, 0))152# First Name Entry153first_entry = Entry(main_frame, bg=BG, fg=FG, font=A12, \154 highlightcolor=FG, textvariable=first_input)155first_entry.focus()156first_entry.pack(side='left', ipady=1)157# ___________________________158# Main Frame (last name)159main_frame = Frame(app, bg=BG)160main_frame.pack(ipady=2)161# Last Name Label162last_label = Label(main_frame, text='Last: ', bg=BG, fg=FG, font=A12)163last_label.pack(side='left', padx=(12, 0))164# Last Name Entry165last_entry = Entry(main_frame, bg=BG, fg=FG, font=A12, \166 highlightcolor=FG, textvariable=last_input)167last_entry.pack(side='left', ipady=1)168# ___________________________169# Main Frame (age)170main_frame = Frame(app, bg=BG)171main_frame.pack(ipady=2)172# Age Label173age_label = Label(main_frame, text='Age: ', bg=BG, fg=FG, font=A12)174age_label.pack(side='left', padx=(12, 0))175# Age Entry176age_entry = Entry(main_frame, bg=BG, fg=FG, font=A12, \177 highlightcolor=FG, textvariable=age_input)178age_entry.pack(side='left', padx=(1, 0), ipady=1)179# ___________________________180# Main Frame (area)181main_frame = Frame(app, bg=BG)182main_frame.pack(ipady=2)183# Area Label184age_label = Label(main_frame, text='Area: ', bg=BG, fg=FG, font=A12)185age_label.pack(side='left', padx=(8, 0))186# Area Entry (location)187area_entry = Entry(main_frame, bg=BG, fg=FG, font=A12, \188 highlightcolor=FG, textvariable=area_input)189area_entry.pack(side='left', padx=(1, 0), ipady=1)190# ___________________________191# Main Frame (email)192main_frame = Frame(app, bg=BG)193main_frame.pack(ipady=2)194# Email Label195email_label = Label(main_frame, text='Email: ', bg=BG, fg=FG, font=A12)196email_label.pack(side='left')197# Email Entry198email_entry = Entry(main_frame, bg=BG, fg=FG, font=A12, \199 highlightcolor=FG, textvariable=email_input)200email_entry.pack(side='left', padx=(3, 0), ipady=1)201# ___________________________202# Main Frame (textarea)203main_frame = Frame(app, bg=BG)204main_frame.pack(pady=(20, 0))205# Text Widget (textarea)206textarea = Text(main_frame, width=36, height=17, bg=BG, fg=FG, font=A12, \207 border=0, state='disabled')208textarea.pack(padx=(90, 0))209# Main Frame (submit button)210main_frame = Frame(app, bg=BG)211main_frame.pack(side='bottom', fill='x')212# Submit Button213sub_btn = Button(main_frame, text='Submit', bg=FG, fg=BG, font=A12, \214 border=0, relief='flat', command=submit_data)215app.bind('<Return>', submit_data)216sub_btn.pack(fill='both', ipady=8)217# ___________________________218# Root Defaults219if __name__ == '__main__':220 app.title('iContact')221 app.geometry('550x660+0-32')222 app.resizable(False, False)...

Full Screen

Full Screen

register.py

Source:register.py Github

copy

Full Screen

1from tkinter import *2from tkinter import ttk3from PIL import ImageTk,Image4from tkinter import messagebox5import mysql.connector6class Register_Window:7 def __init__(self,root):8 self.root=root9 self.root.title("Hotel Management System")10 self.root.geometry("1600x900+0+0")11 # """""""""""""""""""""""Variables""""""""""""""""""""""""12 13 self.var_fname = StringVar()14 self.var_lname = StringVar()15 self.var_contactno = StringVar()16 self.var_email = StringVar()17 self.var_securityQ = StringVar()18 self.var_securityA = StringVar()19 self.var_password = StringVar()20 self.var_confirmPassword = StringVar()21 # """""""""""""""""""""""Image1""""""""""""""""""""""""22 img1 = Image.open(r"D:\Python MiniProject\images\villaregister.jpg")23 img1 = img1.resize((1550,800),Image.ANTIALIAS)24 self.photoimg1 = ImageTk.PhotoImage(img1)25 lblimg = Label(self.root,image=self.photoimg1,bd=0,relief=RIDGE)26 lblimg.place(x=0,y=0,width=1550,height=800)27 # """""""""""""""""""""""Left Image""""""""""""""""""""""""28 img2 = Image.open(r"D:\Python MiniProject\images\leftvillaregister.jpg")29 img2 = img2.resize((470,550),Image.ANTIALIAS)30 self.photoimg2 = ImageTk.PhotoImage(img2)31 lblimg2 = Label(self.root,image=self.photoimg2,bd=0,relief=RIDGE)32 lblimg2.place(x=50,y=100,width=470,height=550)33 # """""""""""""""""""""""Frame""""""""""""""""""""""""34 main_frame = Frame(self.root,bg="black")35 main_frame.place(x=520,y=100,width=800,height=550)36 # """""""""""""""""""""""Labels and Entry""""""""""""""""""""""""37 lbl_title = Label(main_frame,text="Register Here",font=("times new roman",20,"bold"),bg="black",fg="#c90ffc",bd=0,relief=RIDGE)38 lbl_title.place(x=20,y=20)39 lbl_fname = Label(main_frame,text="First Name",font=("times new roman",15,"bold"),bg="#000",fg="#d640ff",bd=0,relief=RIDGE)40 lbl_fname.place(x=50,y=100)41 self.entry_fname = ttk.Entry(main_frame,textvariable=self.var_fname,font=("times new roman",15,"bold"))42 self.entry_fname.place(x=50,y=130,width=250)43 lbl_lname = Label(main_frame,text="Last Name",font=("times new roman",15,"bold"),bg="#000",fg="#d640ff",bd=0,relief=RIDGE)44 lbl_lname.place(x=370,y=100)45 self.entry_lname = ttk.Entry(main_frame,textvariable=self.var_lname,font=("times new roman",15,"bold"))46 self.entry_lname.place(x=370,y=130,width=250)47 lbl_contactno = Label(main_frame,text="Contact No",font=("times new roman",15,"bold"),bg="#000",fg="#d640ff",bd=0,relief=RIDGE)48 lbl_contactno.place(x=50,y=170)49 self.entry_contactno = ttk.Entry(main_frame,textvariable=self.var_contactno,font=("times new roman",15,"bold"))50 self.entry_contactno.place(x=50,y=200,width=250)51 lbl_Email = Label(main_frame,text="Email",font=("times new roman",15,"bold"),bg="#000",fg="#d640ff",bd=0,relief=RIDGE)52 lbl_Email.place(x=370,y=170)53 self.entry_Email = ttk.Entry(main_frame,textvariable=self.var_email,font=("times new roman",15,"bold"))54 self.entry_Email.place(x=370,y=200,width=250)55 lbl_SecurityQuestion = Label(main_frame,text="Security Question",font=("times new roman",15,"bold"),bg="#000",fg="#d640ff",bd=0,relief=RIDGE)56 lbl_SecurityQuestion.place(x=50,y=240)57 combo_SecurityQuestion = ttk.Combobox(main_frame,textvariable=self.var_securityQ,font=("times new roman",15,"bold"),state="readonly")58 combo_SecurityQuestion["value"] = ("Select","Your Birth Place","Your Pet Name","Your Favourite Thing")59 combo_SecurityQuestion.current(0)60 combo_SecurityQuestion.place(x=50,y=270,width=250)61 lbl_SecurityAnswer = Label(main_frame,text="Security Answer",font=("times new roman",15,"bold"),bg="#000",fg="#d640ff",bd=0,relief=RIDGE)62 lbl_SecurityAnswer.place(x=370,y=240)63 self.entry_SecurityAnswer = ttk.Entry(main_frame,textvariable=self.var_securityA,font=("times new roman",15,"bold"))64 self.entry_SecurityAnswer.place(x=370,y=270,width=250)65 lbl_Password = Label(main_frame,text="Password",font=("times new roman",15,"bold"),bg="#000",fg="#d640ff",bd=0,relief=RIDGE)66 lbl_Password.place(x=50,y=310)67 self.entry_Password = ttk.Entry(main_frame,textvariable=self.var_password,font=("times new roman",15,"bold"),show="*")68 self.entry_Password.place(x=50,y=340,width=250)69 lbl_ConfirmPassword = Label(main_frame,text="Confirm Password",font=("times new roman",15,"bold"),bg="#000",fg="#d640ff",bd=0,relief=RIDGE)70 lbl_ConfirmPassword.place(x=370,y=310)71 self.entry_ConfirmPassword = ttk.Entry(main_frame,textvariable=self.var_confirmPassword,font=("times new roman",15,"bold"),show="*")72 self.entry_ConfirmPassword.place(x=370,y=340,width=250)73 # """""""""""""""""""""""Labels and Entry""""""""""""""""""""""""74 self.var_checkbtn = IntVar()75 checkBtn = Checkbutton(main_frame,text="I Agree to all Terms and Conditions!",variable=self.var_checkbtn,font=("times new roman",12,"bold"),bg="#000",fg="#d640ff",activeforeground="#d640ff",activebackground="#000",onvalue=1,offvalue=0)76 checkBtn.place(x=45,y=380)77 # """""""""""""""""""""""ButtonImages""""""""""""""""""""""""78 buttonRegister = Button(main_frame,text="Register Now",command=self.Register_data,font=("times new roman",12,"bold"),borderwidth=0,bg="#9417c2",fg="white",width=10,cursor="hand2",activebackground="#a927d9",activeforeground="white")79 buttonRegister.place(x=50,y=420,width=200)80 lbl_ConfirmPassword = Label(main_frame,text="Already Have An Account?",font=("times new roman",12,"bold"),bg="#000",fg="#d640ff",bd=0,relief=RIDGE)81 lbl_ConfirmPassword.place(x=370,y=380)82 buttonlogin = Button(main_frame,text="Login Now",font=("times new roman",12,"bold"),borderwidth=0,bg="#9417c2",fg="white",width=10,cursor="hand2",activebackground="#a927d9",activeforeground="white")83 buttonlogin.place(x=370,y=420,width=200)84 # """""""""""""""""""""""Function Declaration""""""""""""""""""""""""85 86 def Register_data(self):87 if self.var_fname.get()=="" or self.var_email.get()=="" or self.var_securityQ.get()=="Select" or self.var_securityA.get()=="":88 messagebox.showerror("Error","All Credentials are required!",parent=self.root)89 elif self.var_password.get()!=self.var_confirmPassword.get():90 messagebox.showerror("Error","Password and Confirm Password must be same!",parent=self.root)91 elif self.var_checkbtn.get()==0:92 messagebox.showerror("Error","Please Agree our Terms and Conditions!",parent=self.root)93 else:94 conn = mysql.connector.connect(host="localhost",username="root",password="yash2001",database="management")95 my_cursor = conn.cursor()96 query = ("select * from register where email=%s")97 value = (self.var_email.get(),)98 my_cursor.execute(query,value)99 row = my_cursor.fetchone()100 if row!=None:101 messagebox.showerror("Error","User Already Exists!")102 else:103 my_cursor.execute("insert into register values(%s,%s,%s,%s,%s,%s,%s)",(104 self.var_fname.get(),105 self.var_lname.get(),106 self.var_contactno.get(),107 self.var_email.get(),108 self.var_securityQ.get(),109 self.var_securityA.get(),110 self.var_password.get()111 112 ))113 conn.commit()114 conn.close()115 messagebox.showinfo("Success","Successfully Registered!!!!")116if __name__ == '__main__':117 root=Tk()118 object = Register_Window(root)...

Full Screen

Full Screen

mainframe_selection_helper.py

Source:mainframe_selection_helper.py Github

copy

Full Screen

1#!/usr/bin/env python2#3# Copyright 2008 Google Inc.4#5# Licensed under the Apache License, Version 2.0 (the "License");6# you may not use this file except in compliance with the License.7# You may obtain a copy of the License at8#9# http://www.apache.org/licenses/LICENSE-2.010#11# Unless required by applicable law or agreed to in writing, software12# distributed under the License is distributed on an "AS IS" BASIS,13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14# See the License for the specific language governing permissions and15# limitations under the License.16import launcher17from wxgladegen import main_frame18class MainframeSelectionHelper(object):19 """Helper class that adjusts the launcher's UI based on the selection"""20 def _EnableToolBarButtons(self, button_ids, enable):21 """Enable/Disable the toolbar buttons with the given IDs.22 Args:23 button_ids: list of toolbar button IDs to enable or disable24 enable: boolean value. True for enable a button, False to disable25 """26 toolbar = self._mainframe.GetToolBar()27 for button_id in button_ids:28 toolbar.EnableTool(button_id, enable)29 def _EnableButtons(self, button_ids, enable):30 """Enable/Disable the pushbuttons with the given IDs.31 Args:32 button_ids: list of pushbutton IDs to enable or disable33 enable: boolean value. True for enable a button, False to disable34 """35 for button_id in button_ids:36 button = self._mainframe.GetButtonByID(button_id)37 button.Enable(enable)38 def _EnableMenus(self, menu_item_ids, enable):39 """Enable/Disable the menu items with the given IDs.40 Args:41 menu_item_ids: list of menu item IDs to enable or disable42 enable: boolean value. True for enable a button, False to disable43 """44 menubar = self._mainframe.GetMenuBar()45 for menu_item_id in menu_item_ids:46 menubar.Enable(menu_item_id, enable)47 def _DisableEverything(self):48 """Disable all the controls that make sense to disable."""49 self._EnableToolBarButtons((main_frame.BROWSE_BUTTON,50 main_frame.DASHBOARD_BUTTON,51 main_frame.DEPLOY_BUTTON,52 main_frame.EDIT_BUTTON,53 main_frame.LOGS_BUTTON,54 main_frame.RUN_BUTTON,55 main_frame.SDK_CONSOLE_BUTTON,56 main_frame.STOP_BUTTON), False)57 self._EnableButtons((main_frame.MINUS_BUTTON,), False)58 self._EnableMenus((main_frame.APP_SETTINGS_MENU,59 main_frame.BROWSE_MENU,60 main_frame.DASHBOARD_MENU,61 main_frame.DEPLOY_MENU,62 main_frame.LOGS_MENU,63 main_frame.OPEN_EXTERNAL_EDITOR_MENU,64 main_frame.OPEN_FILE_BROWSER_MENU,65 main_frame.REMOVE_PROJECT_MENU,66 main_frame.RUN_MENU,67 main_frame.RUN_STRICT_MENU,68 main_frame.SDK_CONSOLE_MENU,69 main_frame.STOP_MENU), False)70 def _AnyProjectInState(self, selection, state):71 """Are any of the projects currently in the given runstate?"""72 projects = [p for p in selection if p.runstate == state]73 if projects:74 return True75 else:76 return False77 def _AnyProjectNotInState(self, selection, state):78 """Are any of the projects current not in the given runstate?"""79 projects = [p for p in selection if p.runstate != state]80 if projects:81 return True82 else:83 return False84 def _AllInvalidProjects(self, selection):85 """Are all of the projects invalid?"""86 projects = [p for p in selection if not p.valid]87 if projects == selection:88 return True89 else:90 return False91 def AdjustMainFrame(self, mainframe, selection):92 """Enable/Disable buttons, toolbar items, and menus based on the selection.93 These are the different commands, and their criteria for being enabled:94 * Run - anything selected and in stop state. Disable if all95 invalid or all running96 * Run Strict - anything selected and in stop state. Disable if97 all invalid.98 * Stop - anything selected in run, prod_run, starting state99 * Browse - anything selected and in run, prod_run100 * SDK Console - anything selected and in run, prod_run101 * Deploy - anything selected. Disable if all invalid102 * Dashboard - anything selected. Disable if all invalid103 * App Settings - anything selected. Disable if all invalid104 * Open external editor - anything selected. Disable if all invalid105 * Open file browser - anything selected. Disable if all invalid106 * Remove project - anything selected107 Args:108 mainframe: The top-level container object that holds the items to enable109 or disable.110 selection: A list of launcher.Projects. The run state and valid state111 of the projects controls what gets enabled and disabled.112 """113 self._mainframe = mainframe114 # Turn everything off, then turn on the things that should be enabled.115 self._DisableEverything()116 if not selection:117 return118 # Always enabled if anything is selected.119 self._EnableButtons((main_frame.MINUS_BUTTON,), True)120 self._EnableMenus((main_frame.REMOVE_PROJECT_MENU,), True)121 # Everything else needs at least one valid project.122 if self._AllInvalidProjects(selection):123 return124 # Now juggle stuff based on run state.125 any_not_running = self._AnyProjectNotInState(selection,126 launcher.Project.STATE_RUN)127 # Factor out constant to stay < 80 cols.128 prod_run_state = launcher.Project.STATE_PRODUCTION_RUN129 died_state = launcher.Project.STATE_DIED130 any_not_prod = self._AnyProjectNotInState(selection, prod_run_state)131 any_running = (self._AnyProjectInState(selection,132 launcher.Project.STATE_RUN) or133 self._AnyProjectInState(selection, prod_run_state) or134 self._AnyProjectInState(selection, died_state))135 any_starting = self._AnyProjectInState(selection,136 launcher.Project.STATE_STARTING)137 # These are independent of the projects' run state.138 self._EnableToolBarButtons((main_frame.EDIT_BUTTON,139 main_frame.DEPLOY_BUTTON,140 main_frame.DASHBOARD_BUTTON,141 main_frame.LOGS_BUTTON), True)142 self._EnableMenus((main_frame.APP_SETTINGS_MENU,143 main_frame.OPEN_EXTERNAL_EDITOR_MENU,144 main_frame.OPEN_FILE_BROWSER_MENU,145 main_frame.DEPLOY_MENU,146 main_frame.DASHBOARD_MENU,147 main_frame.LOGS_MENU), True)148 # Can only run if there are stopped projects.149 self._EnableToolBarButtons((main_frame.RUN_BUTTON,),150 any_not_running)151 self._EnableMenus((main_frame.RUN_MENU,), any_not_running)152 self._EnableMenus((main_frame.RUN_STRICT_MENU,), any_not_prod)153 # Can only stop running (or starting) projects.154 self._EnableToolBarButtons((main_frame.STOP_BUTTON,),155 any_running or any_starting)156 self._EnableMenus((main_frame.STOP_MENU,), any_running or any_starting)157 # Can only browse running projects.158 self._EnableToolBarButtons((main_frame.BROWSE_BUTTON,159 main_frame.SDK_CONSOLE_BUTTON), any_running)160 self._EnableMenus((main_frame.BROWSE_MENU,...

Full Screen

Full Screen

GUI_LoadScan_controller.py

Source:GUI_LoadScan_controller.py Github

copy

Full Screen

1from tkinter import *2from tkinter.filedialog import askopenfilename3from view import LoadScan_UI4from view import main_frame5from model import ModelClassifier6from os import path7from _thread import start_new_thread8from tkinter import messagebox9from model.ShowHistogram import ShowHistogram10import os11import numpy as np12import pandas as pd13from tkinter.ttk import Frame, Button, Style, Label14import traceback15import csv16class LoadScan_controller:17 def __init__(self, master):18 self.master = master19 self.img = './view/BCIT_Logo.png'20 self.classifier = ''21 self.test_classifier = ''22 self.test_grab = []23 self.name_test_grab = []24 self.start_counter = 025 self.highest_percent_res = ''26 main_frame.current_frame = LoadScan_UI(self.master, self.img)27 main_frame.current_frame.Open_but.config(command=lambda: self.openFile())28 main_frame.current_frame.classify_but.config(command=lambda: start_new_thread(self.output_classifier, ()))29 main_frame.current_frame.show_but.config(command=lambda: self.show_mesh())30 main_frame.current_frame.hist_but.config(command=lambda: self.show_histogram())31 main_frame.current_frame.can_but.config(command=lambda: self.Exit())32 main_frame.current_frame.more_but.config(command=lambda: self.openSave())33 def openSave(self):34 print('open save')35 result = messagebox.askquestion("Add To Reference Library", "Are You Sure You Want to Add to Library?",36 icon='warning')37 check_duplicate = []38 if result == 'yes':39 print("save button clicked")40 print("grabbing loaded scan from classifier ", self.test_grab)41 with open('./model/hist_data.csv', 'r') as data:42 file_data = pd.read_csv(data, header=None, error_bad_lines=False)43 ref_lib_list = list(file_data.values)44 for each in ref_lib_list:45 if each[0] == self.classifier.matching_shape:46 print('there is a ', self.classifier.matching_shape, " in the lib!")47 check_duplicate.append(each[1:])48 for each in check_duplicate:49 print("each in check duplicate ", list(each))50 list_each = list(each)51 print('self.test_grab', self.test_grab[0])52 if list_each == self.test_grab[0]:53 messagebox.showinfo("Warning", "Entry already exists in database")54 return55 for each in self.test_grab[0]:56 print(' each is ', each)57 self.name_test_grab.append(str(each))58 emp_list = []59 emp_list.append(self.name_test_grab)60 print("new list with name ", self.name_test_grab)61 print('emp list is ', emp_list)62 print('name test grab is ', self.name_test_grab)63 with open('model/hist_data.csv', 'a') as f:64 writer = csv.writer(f, quoting=csv.QUOTE_ALL)65 for each in emp_list:66 writer.writerow(each)67 else:68 print("no")69 def openFile(self):70 """71 Opens file explorer for user to input the desired scan for classification72 """73 filename = askopenfilename(initialdir=path.join(path.dirname(path.realpath(".")), "pyscan/model/scans"),74 title="Select a file")75 if filename != "":76 fname = filename.split('/')77 main_frame.current_frame.log_File_Path.set(fname[-1])78 main_frame.current_frame.Data_listbox.insert(END, "Loaded file: {}".format(fname[-1]))79 self.classifier = ModelClassifier(filename)80 main_frame.current_frame.hist_but.config(state=NORMAL)81 main_frame.current_frame.show_but.config(state=NORMAL)82 def output_classifier(self):83 """84 Calls the classifier to process the input model85 """86 counter = 087 self.start_counter = 188 try:89 if self.classifier.mesh_object != "":90 counter = counter + 191 main_frame.current_frame.Data_listbox.insert(END, "Processing...")92 self.classifier.classify()93 print("self.classifier results", self.classifier.results[0])94 for idx in range(len(self.classifier.results[0])):95 main_frame.current_frame.Data_listbox.insert(96 END, "{0}: {1:.2f}%".format(97 self.classifier.results[0][idx], self.classifier.results[1][idx]))98 main_frame.current_frame.Data_listbox.insert(END, "Match Results:")99 main_frame.current_frame.Data_listbox.insert(END, "It is a {}!".format(self.classifier.matching_shape))100 messagebox.showinfo("Success", "It is a {}! ".format(self.classifier.matching_shape))101 self.name_test_grab.append(self.classifier.matching_shape)102 print("highest percent result type is ", self.name_test_grab)103 self.test_grab = self.classifier.highest104 main_frame.current_frame.more_but.config(state=NORMAL)105 except:106 messagebox.showinfo("Error", "Please load a scan")107 def show_histogram(self):108 """109 Asynch does not work here for some reason110 """111 if self.start_counter != 0:112 main_frame.current_frame.Data_listbox.insert(END, "Generating Histogram...")113 self.classifier.show_histogram(self.classifier.existing_data, self.classifier.data,114 self.classifier.matching_shape)115 print(type(self.classifier.existing_data), type(self.classifier.data))116 else:117 print("showing cubes")118 show_histo = ShowHistogram("hi")119 show_histo.find_shapes()120 # show_histo.show_cubes()121 print("done showing cubes")122 show_histo.compare_histogram()123 def show_mesh(self):124 """125 Displays the model126 """127 self.classifier.mesh_object.show()128 def Exit(self):129 """130 Goes back to the LoadGet UI131 """132 from .GUI_LoadGet_controller import LoadGet_controller133 LoadGet_controller(self.master)134# variation between the shapes135if __name__ == "__main__":136 root = Tk()137 frame = CorS_UI(root)138 ui = LoadGet_controller(root)...

Full Screen

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Python automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful