How to use content_frame method in Playwright Python

Best Python code snippet using playwright-python

main.py

Source:main.py Github

copy

Full Screen

1from tkinter import *2from tkinter import filedialog, messagebox, ttk3import tkinter as tk4from pytz import *5import create_sqlite_db6import sqlite_db_controller7from objects import *8import settings9from settings import *10from email_controller import *11import email_controller12class MainGUI:13 def __init__(self,root):14 """Main tkinter window"""15 self.GITHUB_PAGE = 'https://github.com/ectomorph21/email_marketing'16 self.WEBSITE = 'https://www.randmssolutions.com/'17# print(root.tk.call('tk', 'windowingsystem') )18 settings.SCREEN.append(root.winfo_screenwidth())19 settings.SCREEN.append(root.winfo_screenheight())20 root.option_add('*tearOff', FALSE)21 menubar = Menu(root)22 root['menu'] = menubar23 menu_conn = Menu(menubar)24 menu_user = Menu(menubar)25 menu_customers = Menu(menubar)26 menu_subjects = Menu(menubar)27 menu_templates = Menu(menubar)28 menu_footers = Menu(menubar)29 menu_badDomains = Menu(menubar)30 menu_misc = Menu(menubar)31 menu_help = Menu(menubar, name='help')32 #menu_info = Menu(menubar)33 menubar.add_cascade(menu=menu_conn, label='Connection')34 menubar.add_cascade(menu=menu_user, label='User')35 menubar.add_cascade(menu=menu_customers, label='Customers')36 menubar.add_cascade(menu=menu_subjects, label='Subjects')37 menubar.add_cascade(menu=menu_templates, label='Email_templates')38 menubar.add_cascade(menu=menu_footers, label='Footers')39 menubar.add_cascade(menu=menu_badDomains, label='Bad_domains')40 menubar.add_cascade(menu=menu_misc, label='Misc.')41 menubar.add_cascade(menu=menu_help, label='Help')42 menu_conn.add_command(label="Connect",command=lambda:sqlite_db_controller.locate_file())43 menu_conn.add_command(label="Close",command=lambda:self.close_db())44 menu_user.add_command(label="Create_user",command=lambda:create_sqlite_db.Enter_User_Data())45 menu_user.add_command(label="Update_user",command=lambda:self.update_user())46 menu_customers.add_command(label="Upload customers from CSV",command=lambda:self.upload_customers())47 menu_customers.add_command(label="Export customers to CSV",command=lambda:sqlite_db_controller.export_csv())48 menu_customers.add_command(label="Create customer",command=lambda:sqlite_db_controller.create_customer())49 menu_customers.add_command(label="Update customer",command=lambda:self.update_customer())50 menu_customers.add_command(label="Delete customer",command=lambda:self.delete_customer())51 menu_subjects.add_command(label="View subjects",command=lambda:self.view_subjects())52 menu_subjects.add_command(label="Create subject",command=lambda:sqlite_db_controller.create_subject())53 menu_subjects.add_command(label="Update subject",command=lambda:sqlite_db_controller.update_subject())54 menu_subjects.add_command(label="Delete subject",command=lambda:self.delete_subject())55 menu_templates.add_command(label="View templates",command=lambda:self.view_templates())56 menu_templates.add_command(label="Create template",command=lambda:sqlite_db_controller.create_template())57 menu_templates.add_command(label="Update template",command=lambda:sqlite_db_controller.update_template())58 menu_templates.add_command(label="Delete template",command=lambda:self.delete_template())59 menu_footers.add_command(label="View footers",command=lambda:self.view_footers())60 menu_footers.add_command(label="Create footer",command=lambda:sqlite_db_controller.create_footer())61 menu_footers.add_command(label="Update footer",command=lambda:self.update_footer())62 menu_footers.add_command(label="Delete footer",command=lambda:self.delete_footer())63 menu_badDomains.add_command(label="View bad domains",command=lambda:self.view_bad_domains())64 menu_badDomains.add_command(label="Create bad domains",command=lambda:sqlite_db_controller.add_bad_domain())65 menu_badDomains.add_command(label="Delete bad domains",command=lambda:self.delete_bad_domain())66 menu_misc.add_command(label="View all customers in DB",command=lambda:email_controller.view_all_customers(''))67 menu_misc.add_command(label="View removed customers",68 command=lambda:email_controller.view_all_customers('removed'))69 menu_misc.add_command(label="View customers with bad domains",70 command=lambda:email_controller.view_all_customers('bad_domain'))71 menu_misc.add_command(label="Send random email",command=lambda:email_controller.random_email())72 menu_misc.add_command(label="Send holiday emails",command=lambda:email_controller.view_holiday_email('customer'))73 menu_help.add_command(label="Info",command=lambda:self.About_Software())74 root.title("Email Marketing")75 icon=PhotoImage(file="newLogo.gif")76 root.iconphoto(True,icon)77 root.resizable(FALSE,FALSE)78 welcome_frame = ttk.Frame(root)79 welcome_frame.grid(column=0,row=0)80 s = ttk.Style()81 s.theme_use('alt')82 s.configure('Caution.TButton',font='helvetica 12',foreground='red',padding=3)83 s.configure('Action.TButton',font='helvetica 12',foreground='green',padding=3)84 #customer views and action buttons85 view_prospects = ttk.Button(welcome_frame, text='Send bulk prospects',style='Caution.TButton',86 command=lambda:email_controller.view_next_bulk('prospect'))87 view_prospects.grid(column=1,row=1,sticky=(N,S,E,W))88 view_targets = ttk.Button(welcome_frame, text='Send bulk targets',style='Caution.TButton',89 command=lambda:email_controller.view_next_bulk('target'))90 view_targets.grid(column=2,row=1,sticky=(N,S,E,W))91 view_quoted = ttk.Button(welcome_frame, text='Send bulk quoted',style='Caution.TButton',92 command=lambda:email_controller.view_next_bulk('quoted'))93 view_quoted.grid(column=3,row=1,sticky=(N,S,E,W))94 view_customers = ttk.Button(welcome_frame, text='Send bulk customers',style='Caution.TButton',95 command=lambda:email_controller.view_next_bulk('customer'))96 view_customers.grid(column=4,row=1,sticky=(N,S,E,W))97 view_partners = ttk.Button(welcome_frame, text='Send bulk partners',style='Caution.TButton',98 command=lambda:email_controller.view_next_bulk('partner'))99 view_partners.grid(column=5,row=1,sticky=(N,S,E,W))100 single_prospect = ttk.Button(welcome_frame, text='Send single prospect',style='Caution.TButton',101 command=lambda:email_controller.view_next_single('prospect'))102 single_prospect.grid(column=1,row=2,sticky=(N,S,E,W))103 single_target = ttk.Button(welcome_frame, text='Send single target',style='Caution.TButton',104 command=lambda:email_controller.view_next_single('target'))105 single_target.grid(column=2,row=2,sticky=(N,S,E,W))106 single_quoted = ttk.Button(welcome_frame, text='Send single quoted',style='Caution.TButton',107 command=lambda:email_controller.view_next_single('quoted'))108 single_quoted.grid(column=3,row=2,sticky=(N,S,E,W))109 single_customer = ttk.Button(welcome_frame, text='Send single customer',style='Caution.TButton',110 command=lambda:email_controller.view_next_single('customer'))111 single_customer.grid(column=4,row=2,sticky=(N,S,E,W))112 single_partner = ttk.Button(welcome_frame, text='Send single partner',style='Caution.TButton',113 command=lambda:email_controller.view_next_single('partner'))114 single_partner.grid(column=5,row=2,sticky=(N,S,E,W))115 all_prospects = ttk.Button(welcome_frame, text='View all prospects',style='Action.TButton',116 command=lambda:email_controller.view_all_customers('prospect'))117 all_prospects.grid(column=1,row=3,sticky=(N,S,E,W))118 all_targets = ttk.Button(welcome_frame, text='View all targets',style='Action.TButton',119 command=lambda:email_controller.view_all_customers('target'))120 all_targets.grid(column=2,row=3,sticky=(N,S,E,W))121 all_quoted = ttk.Button(welcome_frame, text='View all quoted',style='Action.TButton',122 command=lambda:email_controller.view_all_customers('quoted'))123 all_quoted.grid(column=3,row=3,sticky=(N,S,E,W))124 all_customers = ttk.Button(welcome_frame, text='View all customers',style='Action.TButton',125 command=lambda:email_controller.view_all_customers('customer'))126 all_customers.grid(column=4,row=3,sticky=(N,S,E,W))127 all_partners = ttk.Button(welcome_frame, text='View all partners',style='Action.TButton',128 command=lambda:email_controller.view_all_customers('partner'))129 all_partners.grid(column=5,row=3,sticky=(N,S,E,W))130 #canvas logo image131 self.canvas = Canvas(welcome_frame,width=600,height=400)132 self.canvas.grid(column=1,row=11,columnspan=4)133 self.myimg = PhotoImage(file='newLogo.gif',height=386,width=500)134 self.canvas.create_image(295,200,image=self.myimg,anchor='center')135 root.protocol("WM_DELETE_WINDOW", self.close_db)136 137 def About_Software(self):138 """Software information with Github and website links"""139 messagebox.showinfo(title="About",message=f"Thank you for using this software.",detail=f"More information can be found at the following links:\n\n{self.GITHUB_PAGE}\n\n{self.WEBSITE}")140 141 def close_db(self):142 """Close SQLite DB connection."""143 sqlite_db_controller.close()144 messagebox.showinfo(parent=root,message='DB closed.',detail='Program will be closed.')145 root.destroy()146 147 def update_user(self):148 """update user method"""149 try:150 user_data = sqlite_db_controller.get_user()151 if user_data == None:152 pass153 else:154 data = user_data.keys()155 user_info = Toplevel()156 user_info.title('User info')157 user_info.resizable(FALSE,FALSE)158 frame = ttk.Frame(user_info)159 frame.grid(column=0,row=0)160 display_user = Canvas(frame,height=675)161 display_user.grid(column=0,row=0)162 #scrollbar163 scrollbar = ttk.Scrollbar(frame,orient=VERTICAL,command=display_user.yview)164 scrollbar.grid(column=1,row=0,sticky=(NS))165 #configure canvas166 display_user.configure(yscrollcommand=scrollbar.set)167 display_user.bind('<Configure>',168 lambda e:display_user.configure(scrollregion=display_user.bbox("all")))169 #content frame170 content_frame = ttk.Frame(display_user,padding=(30,0,0,0))171 #add window to canvas172 display_user.create_window((0,0),window=content_frame)173 time_zone = StringVar()174 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()175 min_entry = Text(content_frame,width=5,height=1)176 min_entry.grid()177 min_entry.insert(1.0,user_data[0])178 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()179 max_entry = Text(content_frame,width=5,height=1)180 max_entry.insert(1.0,user_data[1])181 max_entry.grid()182 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()183 interval = Text(content_frame,width=5,height=1)184 interval.insert(1.0,user_data[2])185 interval.grid()186 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()187 cbox = ttk.Combobox(content_frame,textvariable=time_zone,values=settings.TIME_ZONES)188 cbox.grid()189 cbox.set(user_data[3])190 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()191 domain = Text(content_frame,width=30,height=1)192 domain.insert(1.0,user_data[4])193 domain.grid()194 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()195 smtp = Text(content_frame,width=30,height=1)196 smtp.insert(1.0,user_data[5])197 smtp.grid()198 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()199 port = Text(content_frame,width=5,height=1)200 port.insert(1.0,user_data[6])201 port.grid()202 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()203 login = Text(content_frame,width=30,height=1)204 login.insert(1.0,user_data[7])205 login.grid()206 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()207 password = Text(content_frame,width=30,height=1)208 password.insert(1.0,user_data[8])209 password.grid()210 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()211 header = Text(content_frame,width=40,height=1)212 header.insert(1.0,user_data[9])213 header.grid()214 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()215 unsub = Text(content_frame,width=30,height=1)216 unsub.insert(1.0,user_data[10])217 unsub.grid()218 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()219 mail_list = Text(content_frame,width=15,height=1)220 mail_list.insert(1.0,user_data[11])221 mail_list.grid()222 mail_list['state'] = 'disabled'223 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()224 first = Text(content_frame,width=15,height=1)225 first.insert(1.0,user_data[12])226 first.grid()227 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()228 last = Text(content_frame,width=20,height=1)229 last.insert(1.0,user_data[13])230 last.grid()231 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()232 phone = Text(content_frame,width=15,height=1)233 phone.insert(1.0,user_data[14])234 phone.grid()235 button = ttk.Button(content_frame,text='update',236 command=lambda:[sqlite_db_controller.update_user(min_entry.get(1.0,'end'),max_entry.get(1.0,'end'),237 interval.get(1.0,'end'),time_zone.get(),domain.get(1.0,'end'),smtp.get(1.0,'end'),port.get(1.0,'end'),238 login.get(1.0,'end'),password.get(1.0,'end'),header.get(1.0,'end'),unsub.get(1.0,'end'),239 mail_list.get(1.0,'end'),first.get(1.0,'end'),last.get(1.0,'end'),phone.get(1.0,'end'))240 ,user_info.destroy()])241 button.grid()242 except Exception as e:243 messagebox.showerror(message='Error encountered.',244 detail=f'{e}')245 246 def upload_customers(self):247 """Method to upload customer data from csv file"""248 csv_file = filedialog.askopenfilename(filetypes=[("CSV",'*.csv')])249 if csv_file == () or csv_file == "":250 messagebox.showerror(message='You must select a csv file to utilize this option.')251 else:252 upload_csv = messagebox.askyesno(message='Are you sure you want to upload csv file?',253 detail='This will overwrite current customer data.',icon='question',title='Upload')254 if upload_csv == True:255 sqlite_db_controller.upload_csv(csv_file)256 else:257 messagebox.showinfo(message='Operation cancelled.',detail='No customers added.')258 259 def update_customer(self):260 """Update customer by ID"""261 self.CUSTOMER_ID = IntVar()262 user_entry = Toplevel()263 user_entry.title('Enter customerID')264 label = ttk.Label(user_entry, text='Enter customerID:').pack()265 entry = ttk.Entry(user_entry,justify='center',width=5,textvariable=self.CUSTOMER_ID).pack()266 button = ttk.Button(user_entry,text=f'Submit',command=lambda:[self.print_customer(),267 user_entry.destroy()]).pack()268 269 def print_customer(self):270 """This is where single customer information will be displayed for updates"""271 customer = sqlite_db_controller.get_byCustomerID(self.CUSTOMER_ID.get())272 if customer == None:273 messagebox.showerror(message='no customer with that ID exist in DB')274 else:275 data = customer.keys()276 customer_info = Toplevel()277 customer_info.title(f'Customer# {customer[0]} info')278 customer_info.resizable(FALSE,FALSE)279 frame = ttk.Frame(customer_info)280 frame.grid(column=0,row=0)281 display_customer = Canvas(frame,height=500)282 display_customer.grid(column=0,row=0)283 #scrollbar284 scrollbar = ttk.Scrollbar(frame,orient=VERTICAL,command=display_customer.yview)285 scrollbar.grid(column=1,row=0,sticky=(NS))286 #configure canvas287 display_customer.configure(yscrollcommand=scrollbar.set)288 display_customer.bind('<Configure>',289 lambda e:display_customer.configure(scrollregion=display_customer.bbox("all")))290 #content frame291 content_frame = ttk.Frame(display_customer,padding=(30,0,0,0))292 #add window to canvas293 display_customer.create_window((0,0),window=content_frame)294 status = StringVar()295 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()296 customer_id = Text(content_frame,width=6,height=1)297 customer_id.grid()298 customer_id.insert(1.0,customer[0])299 customer_id['state'] = 'disabled'300 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()301 company = Text(content_frame,width=20,height=1)302 company.insert(1.0,customer[1])303 company.grid()304 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()305 city = Text(content_frame,width=15,height=1)306 city.insert(1.0,customer[2])307 city.grid()308 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()309 state = Text(content_frame,width=3,height=1)310 state.insert(1.0,customer[3])311 state.grid()312 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()313 cbox = ttk.Combobox(content_frame,textvariable=status,values=settings.CUSTOMER_STATUS)314 cbox.grid()315 cbox.set(customer[4])316 cbox.state(["readonly"])317 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()318 first = Text(content_frame,width=15,height=1)319 first.insert(1.0,customer[5])320 first.grid()321 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()322 last = Text(content_frame,width=15,height=1)323 last.insert(1.0,customer[6])324 last.grid()325 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()326 email = Text(content_frame,width=30,height=1)327 email.insert(1.0,customer[7])328 email.grid()329 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()330 contact = Text(content_frame,width=10,height=1)331 contact.insert(1.0,customer[8])332 contact.grid()333 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()334 notes = Text(content_frame,width=30,height=1)335 notes.insert(1.0,customer[9])336 notes.grid()337 button = ttk.Button(content_frame,text='update',338 command=lambda:[sqlite_db_controller.update_customer(customer_id.get(1.0,'end'),company.get(1.0,'end'),339 city.get(1.0,'end'),state.get(1.0,'end'),status.get(),first.get(1.0,'end'),last.get(1.0,'end'),340 email.get(1.0,'end'),contact.get(1.0,'end'),notes.get(1.0,'end')),customer_info.destroy()])341 button.grid()342 343 def delete_customer(self):344 """Where customer will be selected for deletion by customerID"""345 self.CUSTOMER_ID = IntVar()346 user_entry = Toplevel()347 user_entry.title('Enter customerID')348 label = ttk.Label(user_entry, text='Enter customerID:').pack()349 entry = ttk.Entry(user_entry,justify='center',width=5,textvariable=self.CUSTOMER_ID).pack()350 button = ttk.Button(user_entry,text=f'Submit',351 command=lambda:[sqlite_db_controller.delete_customer(self.CUSTOMER_ID.get()),user_entry.destroy()]).pack()352 353 def view_subjects(self):354 """View subjects in DB"""355 subjects = sqlite_db_controller.get_subjects()356 if subjects == None:357 pass358 else:359 result = ""360 for s in subjects:361 result += f"subjectID: {s.subjectID}\nCustomer: {s.subject_customer}\nSubject: {s.subject}\n\n"362 subject_display = Toplevel()363 subject_display.title('All subjects')364 subject_display.geometry('500x300-75-75')365 display_subjects = Text(subject_display,width=500,height=300)366 ys = ttk.Scrollbar(subject_display,orient='vertical',command=display_subjects.yview)367 display_subjects['yscrollcommand'] = ys.set368 display_subjects.grid(column=0,row=0)369 ys.grid(column=1,row=0,sticky=(N,S))370 display_subjects.insert(1.0,result)371 subject_display.grid_columnconfigure(0,weight=1)372 subject_display.grid_rowconfigure(0,weight=1)373 374 def delete_subject(self):375 """Delete subject by subjectID"""376 subject_id = IntVar()377 user_entry = Toplevel()378 user_entry.title('Enter subjectID')379 label = ttk.Label(user_entry, text='Enter subjectID:').pack()380 entry = ttk.Entry(user_entry,justify='center',width=5,textvariable=subject_id).pack()381 button = ttk.Button(user_entry,text=f'Submit',382 command=lambda:[sqlite_db_controller.delete_subject(subject_id.get()),user_entry.destroy()]).pack()383 384 def view_templates(self):385 """View email templates in DB"""386 templates = sqlite_db_controller.get_templates()387 if templates == None:388 pass389 else:390 result = ""391 for t in templates:392 result += f"emailbodyID: {t.emailbodyID}\nCustomer: {t.email_body_customer}\nEmail: {t.emailbody}\n\n"393 template_display = Toplevel()394 template_display.title('All email templates')395 template_display.geometry('1360x738')396 display_templates = Text(template_display,width=1360,height=738)397 ys = ttk.Scrollbar(template_display,orient='vertical',command=display_templates.yview)398 display_templates['yscrollcommand'] = ys.set399 display_templates.grid(column=0,row=0)400 ys.grid(column=1,row=0,sticky=(N,S))401 display_templates.insert(1.0,result)402 template_display.grid_columnconfigure(0,weight=1)403 template_display.grid_rowconfigure(0,weight=1)404 405 def delete_template(self):406 """Delete email template"""407 emailbody_id = IntVar()408 user_entry = Toplevel()409 user_entry.title('Enter emailbodyID')410 label = ttk.Label(user_entry, text='Enter emailbodyID:').pack()411 entry = ttk.Entry(user_entry,justify='center',width=5,textvariable=emailbody_id).pack()412 button = ttk.Button(user_entry,text=f'Submit',413 command=lambda:[sqlite_db_controller.delete_template(emailbody_id.get()),user_entry.destroy()]).pack()414 415 def view_footers(self):416 """View email footer templates in DB"""417 footers = sqlite_db_controller.get_footers()418 if footers == None:419 pass420 else:421 result = ""422 for f in footers:423 result += f"footerID: {f.footerID}\nHeadline: {f.headline}\nline1: {f.feature1}\nline2: {f.feature2}\nline3: {f.feature3}\nline4: {f.feature4}\nline5: {f.feature5}\nline6: {f.feature6}\nline7: {f.feature7}\nline8: {f.feature8}\n\n"424 footer_display = Toplevel()425 footer_display.title('All footer templates')426 footer_display.geometry('500x300-75-75')427 display_footers = Text(footer_display,width=500,height=300)428 ys = ttk.Scrollbar(footer_display,orient='vertical',command=display_footers.yview)429 display_footers['yscrollcommand'] = ys.set430 display_footers.grid(column=0,row=0)431 ys.grid(column=1,row=0,sticky=(N,S))432 display_footers.insert(1.0,result)433 footer_display.grid_columnconfigure(0,weight=1)434 footer_display.grid_rowconfigure(0,weight=1)435 436 def update_footer(self):437 """Update email footer template in DB"""438 self.FOOTER_ID = IntVar()439 user_entry = Toplevel()440 user_entry.title('Enter footerID')441 label = ttk.Label(user_entry, text='Enter footerID:').pack()442 entry = ttk.Entry(user_entry,justify='center',width=5,textvariable=self.FOOTER_ID).pack()443 button = ttk.Button(user_entry,text=f'Submit',command=lambda:[self.print_footer(),444 user_entry.destroy()]).pack()445 446 def print_footer(self):447 """This is where single footer information will be displayed for updates"""448 footer = sqlite_db_controller.get_byFooterID(self.FOOTER_ID.get())449 if footer == None:450 messagebox.showerror(message='no footer with that ID exist in DB')451 else:452 self.NEW_DATA = StringVar()453 data = footer.keys()454 f_info = Toplevel()455 f_info.title(f'Footer# {self.FOOTER_ID.get()} info')456 f_info.resizable(FALSE,FALSE)457 frame = ttk.Frame(f_info)458 frame.grid(column=0,row=0)459 display_footer = Canvas(frame,height=500)460 display_footer.grid(column=0,row=0)461 #scrollbar462 scrollbar = ttk.Scrollbar(frame,orient=VERTICAL,command=display_footer.yview)463 scrollbar.grid(column=1,row=0,sticky=(NS))464 #configure canvas465 display_footer.configure(yscrollcommand=scrollbar.set)466 display_footer.bind('<Configure>',467 lambda e:display_footer.configure(scrollregion=display_footer.bbox("all")))468 #content frame469 content_frame = ttk.Frame(display_footer,padding=(30,0,0,0))470 #add window to canvas471 display_footer.create_window((0,0),window=content_frame)472 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()473 footer_id = Text(content_frame,width=3,height=1)474 footer_id.grid()475 footer_id.insert(1.0,footer[0])476 footer_id['state'] = 'disabled'477 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()478 headline = Text(content_frame,width=30,height=1)479 headline.insert(1.0,footer[1])480 headline.grid()481 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()482 feature1 = Text(content_frame,width=30,height=1)483 feature1.insert(1.0,footer[2])484 feature1.grid()485 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()486 feature2 = Text(content_frame,width=30,height=1)487 feature2.insert(1.0,footer[3])488 feature2.grid()489 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()490 feature3 = Text(content_frame,width=30,height=1)491 feature3.insert(1.0,footer[4])492 feature3.grid()493 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()494 feature4 = Text(content_frame,width=30,height=1)495 feature4.insert(1.0,footer[5])496 feature4.grid()497 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()498 feature5 = Text(content_frame,width=30,height=1)499 feature5.insert(1.0,footer[6])500 feature5.grid()501 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()502 feature6 = Text(content_frame,width=30,height=1)503 feature6.insert(1.0,footer[7])504 feature6.grid()505 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()506 feature7 = Text(content_frame,width=30,height=1)507 feature7.insert(1.0,footer[8])508 feature7.grid()509 label = ttk.Label(content_frame,text=f'{data.pop(0)}').grid()510 feature8 = Text(content_frame,width=30,height=1)511 feature8.insert(1.0,footer[9])512 feature8.grid()513 button = ttk.Button(content_frame,text='update',514 command=lambda:[sqlite_db_controller.update_footer(footer_id.get(1.0,'end'),headline.get(1.0,'end'),515 feature1.get(1.0,'end'),feature2.get(1.0,'end'),feature3.get(1.0,'end'),feature4.get(1.0,'end'),516 feature5.get(1.0,'end'),feature6.get(1.0,'end'),feature7.get(1.0,'end'),feature8.get(1.0,'end')),517 f_info.destroy()])518 button.grid()519 520 def delete_footer(self):521 """Delete email footer template"""522 footer_id = IntVar()523 user_entry = Toplevel()524 user_entry.title('Enter footerID')525 label = ttk.Label(user_entry, text='Enter footerID:').pack()526 entry = ttk.Entry(user_entry,justify='center',width=5,textvariable=footer_id).pack()527 button = ttk.Button(user_entry,text=f'Submit',528 command=lambda:[sqlite_db_controller.delete_footer(footer_id.get()),user_entry.destroy()]).pack()529 530 def view_bad_domains(self):531 """View bad domains in DB"""532 bad_domains = sqlite_db_controller.get_bad_domains()533 if bad_domains == None:534 pass535 else:536 result = ""537 for bd in bad_domains:538 result += f"emailcheckID: {bd.emailcheckID}\ndomain: {bd.domain}\n\n"539 bd_display = Toplevel()540 bd_display.title('Bad email domains')541 bd_display.geometry('500x300-75-75')542 display_bad_domains = Text(bd_display,width=500,height=300)543 ys = ttk.Scrollbar(bd_display,orient='vertical',command=display_bad_domains.yview)544 display_bad_domains['yscrollcommand'] = ys.set545 display_bad_domains.grid(column=0,row=0)546 ys.grid(column=1,row=0,sticky=(N,S))547 display_bad_domains.insert(1.0,result)548 bd_display.grid_columnconfigure(0,weight=1)549 bd_display.grid_rowconfigure(0,weight=1)550 551 def delete_bad_domain(self):552 """Delete bad domain"""553 emailcheck_id = IntVar()554 user_entry = Toplevel()555 user_entry.title('Enter emailcheckID')556 label = ttk.Label(user_entry, text='Enter emailcheckID:').pack()557 entry = ttk.Entry(user_entry,justify='center',width=5,textvariable=emailcheck_id).pack()558 button = ttk.Button(user_entry,text=f'Submit',559 command=lambda:[sqlite_db_controller.delete_emailcheck(emailcheck_id.get()),user_entry.destroy()]).pack()560 561root = Tk()562MainGUI(root)...

Full Screen

Full Screen

check_in.py

Source:check_in.py Github

copy

Full Screen

1import tkinter as tk2from PIL import Image, ImageTk3import random4from tkinter import messagebox as Msg5class CheckIn(tk.Frame):6 def __init__(self, parent, App): #self.container, self.app7 self.app = App8 self.settings = App.settings9 super().__init__(parent)10 self.configure(bg=self.settings.board_color)11 self.grid(row=0, column=0, sticky="nsew")12 parent.grid_rowconfigure(0, weight=1)13 parent.grid_columnconfigure(0, weight=1)14 # virtual image15 self.virtual_image = tk.PhotoImage(width = 1, height = 1)16 self.info = {}17 self.filled = False18 self.create_header()19 self.create_content()20 def create_header(self):21 frame_h =self.settings.height//522 self.header_frame = tk.Frame(self, bg = self.settings.board_color, width = self.settings.width, height = frame_h)23 self.header_frame.pack(fill = "x")24 self.back_frame = tk.Frame(self.header_frame, bg = self.settings.board_color, width = self.settings.width//10, height = frame_h//2)25 self.back_frame.grid(row = 0, column = 0, sticky = "ne")26 self.header_frame_ = tk.Frame(self.header_frame, bg = self.settings.board_color, width = 9*self.settings.width//10, height = frame_h)27 self.header_frame_.grid(row = 0, column = 1, sticky = 'nsew')28 self.header_label = tk.Label(self.header_frame_, text = "Check In", fg = self.settings.font_color, bg = self.settings.board_color ,font = self.settings.header_font, image = self.virtual_image, compound = "c")29 self.header_label.place(x= 195, y= 15)30 self.header_frame.grid_columnconfigure(0, weight = 1)31 self.header_frame.grid_rowconfigure(0, weight = 1)32 self.back_photo = tk.PhotoImage(file=self.settings.back_img)33 image = Image.open(self.settings.back_img)34 image_w, image_h = image.size35 ratio = 1236 new_size = (int(image_w//ratio), int(image_h//ratio))37 image = image.resize(new_size)38 self.back_photo = ImageTk.PhotoImage(image)39 self.back = tk.Button(self.back_frame, image = self.back_photo, bd = 0, bg = self.settings.board_color, command=self.app.back, height = frame_h//2, width = self.settings.width//10, activebackground = self.settings.board_color)40 self.back.grid(column=0, row=0, padx=(0,508))41 self.header_frame.grid_columnconfigure(0, weight = 1)42 self.header_frame.grid_rowconfigure(0, weight = 1)43 def create_content(self):44 frame_h = self.settings.height//345 width = self.settings.width46 # name, address, phone number, day47 self.content_frame = tk.Frame(self, bg = self.settings.board_color)48 self.content_frame.pack(fill = "both", expand = True)49 self.detail_frame = tk.Frame(self.content_frame, bg = self.settings.board_color, width = width//3, height = frame_h)50 self.detail_frame.grid(sticky = 'ne', row = 0, column = 0)51 self.details_label = []52 details = ['name :', 'address :', 'phone number :', 'day :']53 y = 054 for detail in details:55 label = tk.Label(self.detail_frame, text=detail, bg=self.settings.board_color, fg=self.settings.font_color, font=self.settings.content_font)56 if self.settings.font == 'large':57 label.place(x = 95, y = y)58 y += 4559 elif self.settings.font == 'medium':60 label.place(x = 115, y = y)61 y += 4562 elif self.settings.font == 'small':63 label.place(x = 155, y = y)64 y += 4865 self.details_label.append(label)66 self.entry_frame = tk.Frame(self.content_frame, bg = self.settings.board_color, width = 2*width//3, height = 3*frame_h)67 self.entry_frame.grid(sticky = 'ne', row = 0, column = 1)68 self.name = tk.StringVar()69 self.name_entry =tk.Entry(self.entry_frame, fg='black', font=self.settings.content_font, textvariable = self.name)70 self.address = tk.StringVar()71 self.address_entry =tk.Entry(self.entry_frame, fg='black', font=self.settings.content_font,width = 45, textvariable = self.address)72 self.p_nmbr = tk.StringVar()73 self.p_nmbr_entry =tk.Entry(self.entry_frame, fg='black', font=self.settings.content_font,width = 45, textvariable = self.p_nmbr)74 self.day = tk.StringVar()75 self.day_entry =tk.Entry(self.entry_frame, fg='black', font=self.settings.content_font,width = 45, textvariable = self.day)76 # room type77 self.room_type_label = tk.Label(self.content_frame, text= "room type :", bg=self.settings.board_color, fg=self.settings.font_color, font=self.settings.content_font)78 self.room_type_label.place(x = 350, y = 180)79 self.room_type = tk.IntVar()80 self.dlx_rad = tk.Radiobutton(self.content_frame, text = "delux", value = 1, font=self.settings.content_font, variable = self.room_type, bg = self.settings.board_color, activebackground = self.settings.board_color )81 self.dlx_rad_ = tk.Label(self.content_frame, text = "delux", font=self.settings.content_font, bg = self.settings.board_color, fg = self.settings.font_color)82 83 self.nrml_rad = tk.Radiobutton(self.content_frame, text = "normal", value = 2, font=self.settings.content_font, variable = self.room_type, bg = self.settings.board_color, activebackground = self.settings.board_color)84 self.nrml_rad_ = tk.Label(self.content_frame, text = "normal", font=self.settings.content_font, bg = self.settings.board_color, fg = self.settings.font_color)85 self.prsdt_rad = tk.Radiobutton(self.content_frame, text = "president", value = 3, font=self.settings.content_font, variable = self.room_type , bg = self.settings.board_color, activebackground = self.settings.board_color)86 self.prsdt_rad_ = tk.Label(self.content_frame, text = "president", font=self.settings.content_font, bg = self.settings.board_color, fg = self.settings.font_color)87 88 self.jnt_rad = tk.Radiobutton(self.content_frame, text = "joint", value = 4, font=self.settings.content_font, variable = self.room_type , bg = self.settings.board_color, activebackground = self.settings.board_color)89 self.jnt_rad_ = tk.Label(self.content_frame, text = "joint",font=self.settings.content_font, bg = self.settings.board_color, fg = self.settings.font_color)90 91 self.pymnt_label = tk.Label(self.content_frame, text= "payment :", bg=self.settings.board_color, fg=self.settings.font_color, font=self.settings.content_font)92 93 self.payment = tk.IntVar()94 self.cash_rad = tk.Radiobutton(self.content_frame, text = 'by cash', value = 1, font=self.settings.content_font, variable = self.payment, bg = self.settings.board_color, activebackground = self.settings.board_color)95 self.cash_rad_ = tk.Label(self.content_frame, text = 'by cash', font=self.settings.content_font, bg = self.settings.board_color, fg = self.settings.font_color)96 97 self.card_rad = tk.Radiobutton(self.content_frame, text = 'by credit / debit card', value = 2, font=self.settings.content_font, variable = self.payment, bg = self.settings.board_color, activebackground = self.settings.board_color)98 self.card_rad_ = tk.Label(self.content_frame, text = 'by credit / debit card', font=self.settings.content_font, bg = self.settings.board_color, fg = self.settings.font_color)99 100 self.sumbit_buttton = tk.Button(self.content_frame, text = "Sumbit", font = self.settings.content_font, bd = 0, width = 15, bg = self.settings.color_theme, fg = self.settings.board_color, command = self.sumbit, activebackground = self.settings.color_theme)101 102 self.placement()103 self.content_frame.grid_columnconfigure(0, weight = 1)104 self.content_frame.grid_rowconfigure(0, weight = 1)105 def placement(self):106 if self.settings.font == 'large':107 self.name_entry.configure(width = 45)108 self.name_entry.place(x = 5, y = 5)109 self.address_entry.configure(width = 45)110 self.address_entry.place(x = 5, y = 50)111 self.p_nmbr_entry.configure(width = 45)112 self.p_nmbr_entry.place(x = 5, y = 95)113 self.day_entry.configure(width = 45)114 self.day_entry.place(x = 5, y = 140)115 self.dlx_rad.place(x = 75, y = 205)116 self.dlx_rad_.place(x = 95, y = 208)117 self.nrml_rad.place(x = 250, y = 205)118 self.nrml_rad_.place(x = 270, y = 208)119 self.prsdt_rad.place(x = 425, y = 205)120 self.prsdt_rad_.place(x = 445, y = 208)121 self.jnt_rad.place(x = 600, y = 205)122 self.jnt_rad_.place(x = 620, y = 208)123 self.pymnt_label.place(x = 350, y = 240)124 self.cash_rad.place(x = 200, y = 270)125 self.cash_rad_.place(x = 220, y = 273)126 self.card_rad.place(x = 400, y = 270)127 self.card_rad_.place(x = 420, y = 273)128 self.sumbit_buttton.place(x = 605, y = 355)129 elif self.settings.font == 'medium':130 self.name_entry.configure(width = 45)131 self.name_entry.place(x = 5, y = 5)132 self.address_entry.configure(width = 45)133 self.name_entry.place(x = 5, y = 5)134 self.address_entry.configure(width = 45)135 self.address_entry.place(x = 5, y = 50)136 self.p_nmbr_entry.configure(width = 45)137 self.p_nmbr_entry.place(x = 5, y = 95)138 self.day_entry.configure(width = 45)139 self.day_entry.place(x = 5, y = 140)140 self.dlx_rad.place(x = 75, y = 205)141 self.dlx_rad_.place(x = 95, y = 208 )142 self.nrml_rad.place(x = 250, y = 205)143 self.nrml_rad_.place(x = 270, y = 208)144 self.prsdt_rad.place(x = 425, y = 205)145 self.prsdt_rad_.place(x = 445, y = 208)146 self.jnt_rad.place(x = 600, y = 205)147 self.jnt_rad_.place(x = 620, y = 208)148 self.pymnt_label.place(x = 350, y = 240)149 self.cash_rad.place(x = 200, y = 270)150 self.cash_rad_.place(x = 220, y = 273)151 self.card_rad.place(x = 400, y = 270)152 self.card_rad_.place(x = 420, y = 273)153 self.sumbit_buttton.place(x = 635, y = 365)154 elif self.settings.font == 'small':155 self.name_entry.configure(width = 55)156 self.name_entry.place(x = 0, y = 1)157 self.address_entry.configure(width = 55)158 self.address_entry.place(x = 0, y = 48)159 self.p_nmbr_entry.configure(width = 55)160 self.p_nmbr_entry.place(x = 0, y = 97)161 self.day_entry.configure(width = 55)162 self.day_entry.place(x = 0, y = 145)163 self.dlx_rad.place(x = 85, y = 205)164 self.dlx_rad_.place(x = 105, y = 207 )165 self.nrml_rad.place(x = 260, y = 205)166 self.nrml_rad_.place(x = 280, y = 207)167 self.prsdt_rad.place(x = 435, y = 205)168 self.prsdt_rad_.place(x = 455, y = 207)169 self.jnt_rad.place(x = 610, y = 205)170 self.jnt_rad_.place(x = 630, y = 207)171 self.pymnt_label.place(x = 350, y = 240)172 self.cash_rad.place(x = 200, y = 270)173 self.cash_rad_.place(x = 220, y = 273)174 self.card_rad.place(x = 400, y = 270)175 self.card_rad_.place(x = 420, y = 273)176 self.sumbit_buttton.place(x = 685, y = 375)177 def sumbit(self):178 guest_name = self.name.get()179 guest_address = self.address.get()180 guset_phone = self.p_nmbr.get()181 day_stay = self.day.get()182 room_type = self.room_type.get()183 pymnt = self.payment.get()184 room_number = random.randint(1,10)185 if room_type == 1:186 room_type = 'Delux'187 elif room_type == 2:188 room_type = 'Normal'189 elif room_type == 3:190 room_type = 'President'191 elif room_type == 4:192 room_type = 'Joint'193 if pymnt == 1:194 pymnt = 'cash'195 elif pymnt == 2:196 pymnt = 'card'197 self.check_filled()198 if self.filled == True:199 info = {f'{room_type}-{room_number}' : {'name':guest_name, 'address' : guest_address, 'p_nmbr' : guset_phone, 'day' : day_stay, 'payment' : pymnt}}200 self.settings.guest.append(info)201 self.settings.save_data()202 Msg.showinfo("Hotel Management", "Check In Successed")203 self.app.check_in_page()204 else:205 Msg.showwarning("Hotel Management", "Please Fill The Forum")206 def check_filled(self):207 guest_name = self.name.get()208 guest_address = self.address.get()209 guset_phone = self.p_nmbr.get()210 day_stay = self.day.get()211 room_type = self.room_type.get()212 pymnt = self.payment.get()213 if guest_name == '' or guest_address == '' or guset_phone == '' or day_stay == '' or room_type == '' or pymnt == '' :214 self.filled = False215 else:...

Full Screen

Full Screen

check_out.py

Source:check_out.py Github

copy

Full Screen

1import tkinter as tk2from PIL import Image, ImageTk3import random4import sys5import time6from tkinter import messagebox as Msg7class CheckOut(tk.Frame):8 def __init__(self, parent, App):9 self.app = App10 self.settings = App.settings11 self.filled = False12 self.delete = False13 #CONFIG FRAME14 super().__init__(parent) #parent -> container di Game15 self.configure(bg=self.settings.board_color)16 self.grid(row=0, column=0, sticky="nsew")17 parent.grid_rowconfigure(0, weight=1)18 parent.grid_columnconfigure(0, weight=1)19 self.virtual_image = tk.PhotoImage(width = 1, height = 1)20 self.create_header()21 self.create_button()22 def create_header(self):23 frame_h =self.settings.height//524 self.header_frame = tk.Frame(self, bg = self.settings.board_color, width = self.settings.width, height = frame_h)25 self.header_frame.pack(fill = "x")26 self.back_frame = tk.Frame(self.header_frame, bg = self.settings.board_color, width = self.settings.width//10, height = frame_h//2)27 self.back_frame.grid(row = 0, column = 0, sticky = "ne")28 self.header_frame_ = tk.Frame(self.header_frame, bg = self.settings.board_color, width = 9*self.settings.width//10, height = frame_h)29 self.header_frame_.grid(row = 0, column = 1, sticky = 'nsew')30 self.header_label = tk.Label(self.header_frame_, text = "Check Out", fg = self.settings.font_color, bg = self.settings.board_color ,font = self.settings.header_font, image = self.virtual_image, compound = "c")31 self.header_label.place(x= 195, y= 15)32 self.header_frame.grid_columnconfigure(0, weight = 1)33 self.header_frame.grid_rowconfigure(0, weight = 1)34 self.back_photo = tk.PhotoImage(file=self.settings.back_img)35 image = Image.open(self.settings.back_img)36 image_w, image_h = image.size37 ratio = 1238 new_size = (int(image_w//ratio), int(image_h//ratio))39 image = image.resize(new_size)40 self.back_photo = ImageTk.PhotoImage(image)41 self.back = tk.Button(self.back_frame, image = self.back_photo, bd = 0, bg = self.settings.board_color, command=self.app.back, height = frame_h//2, width = self.settings.width//10, activebackground = self.settings.board_color)42 self.back.grid(column=0, row=0, padx=(0,508))43 self.header_frame.grid_columnconfigure(0, weight = 1)44 self.header_frame.grid_rowconfigure(0, weight = 1)45 def create_button(self):46 frame_h = self.settings.height//347 width = self.settings.width48 # name, address, phone number, day49 self.content_frame = tk.Frame(self, bg = self.settings.board_color)50 self.content_frame.pack(fill = "both", expand = True)51 self.detail_frame = tk.Frame(self.content_frame, bg = self.settings.board_color, width = width//3, height = 3*frame_h)52 self.detail_frame.grid(sticky = 'ne', row = 0, column = 0)53 self.details_label = []54 details = ['name :', 'address :', 'phone number :', 'room number :']55 y = 2056 for detail in details:57 label = tk.Label(self.detail_frame, text=detail, bg=self.settings.board_color, fg=self.settings.font_color, font=self.settings.content_font)58 if self.settings.font == 'large':59 label.place(x = 90, y = y)60 y += 4561 elif self.settings.font == 'medium':62 label.place(x = 115, y = y)63 y += 4564 elif self.settings.font == 'small':65 label.place(x = 155, y = y)66 y += 4867 self.details_label.append(label)68 self.entry_frame = tk.Frame(self.content_frame, bg = self.settings.board_color, width = 2*width//3, height = 3*frame_h)69 self.entry_frame.grid(sticky = 'ne', row = 0, column = 1)70 self.name = tk.StringVar()71 self.name_entry =tk.Entry(self.entry_frame, fg='black', font=self.settings.content_font, textvariable = self.name)72 self.address = tk.StringVar()73 self.address_entry =tk.Entry(self.entry_frame, fg='black', font=self.settings.content_font,width = 45, textvariable = self.address)74 self.p_nmbr = tk.StringVar()75 self.p_nmbr_entry =tk.Entry(self.entry_frame, fg='black', font=self.settings.content_font,width = 45, textvariable = self.p_nmbr)76 self.nmbr = tk.StringVar()77 self.nmbr_entry =tk.Entry(self.entry_frame, fg='black', font=self.settings.content_font,width = 45, textvariable = self.nmbr) 78 # room type79 self.room_type_label = tk.Label(self.content_frame, text= "room type :", bg=self.settings.board_color, fg=self.settings.font_color, font=self.settings.content_font)80 81 self.room_type = tk.IntVar()82 self.dlx_rad = tk.Radiobutton(self.content_frame, text = "delux", value = 1, font=self.settings.content_font, variable = self.room_type, bg = self.settings.board_color, activebackground = self.settings.board_color )83 self.dlx_rad_ = tk.Label(self.content_frame, text = "delux", font=self.settings.content_font, bg = self.settings.board_color, fg = self.settings.font_color)84 85 self.nrml_rad = tk.Radiobutton(self.content_frame, text = "normal", value = 2, font=self.settings.content_font, variable = self.room_type, bg = self.settings.board_color, activebackground = self.settings.board_color)86 self.nrml_rad_ = tk.Label(self.content_frame, text = "normal", font=self.settings.content_font, bg = self.settings.board_color, fg = self.settings.font_color)87 self.prsdt_rad = tk.Radiobutton(self.content_frame, text = "president", value = 3, font=self.settings.content_font, variable = self.room_type , bg = self.settings.board_color, activebackground = self.settings.board_color)88 self.prsdt_rad_ = tk.Label(self.content_frame, text = "president", font=self.settings.content_font, bg = self.settings.board_color, fg = self.settings.font_color)89 90 self.jnt_rad = tk.Radiobutton(self.content_frame, text = "joint", value = 4, font=self.settings.content_font, variable = self.room_type , bg = self.settings.board_color, activebackground = self.settings.board_color)91 self.jnt_rad_ = tk.Label(self.content_frame, text = "joint",font=self.settings.content_font, bg = self.settings.board_color, fg = self.settings.font_color)92 self.sumbit_buttton = tk.Button(self.content_frame, text = "Check Out", font = self.settings.content_font, bd = 0, width = 15, bg = self.settings.color_theme, fg = self.settings.board_color, command = self.check_out, activebackground = self.settings.color_theme)93 self.placement()94 self.content_frame.grid_columnconfigure(0, weight = 1)95 self.content_frame.grid_rowconfigure(0, weight = 1)96 def placement(self):97 if self.settings.font == 'large':98 self.name_entry.configure(width = 45)99 self.name_entry.place(x = 0, y = 25)100 self.address_entry.configure(width = 45)101 self.address_entry.place(x = 0, y = 70)102 self.p_nmbr_entry.configure(width = 45)103 self.p_nmbr_entry.place(x = 0, y = 115)104 self.nmbr_entry.configure(width = 45)105 self.nmbr_entry.place(x = 0, y = 160)106 self.room_type_label.place(x = 350, y = 200)107 self.dlx_rad.place(x = 75, y = 235)108 self.dlx_rad_.place(x = 95, y = 238)109 self.nrml_rad.place(x = 250, y = 235)110 self.nrml_rad_.place(x = 270, y = 238)111 self.prsdt_rad.place(x = 425, y = 235)112 self.prsdt_rad_.place(x = 445, y = 238)113 self.jnt_rad.place(x = 600, y = 235)114 self.jnt_rad_.place(x = 620, y = 238)115 self.sumbit_buttton.place(x = 605, y = 355)116 elif self.settings.font == 'medium':117 self.name_entry.configure(width = 45)118 self.name_entry.place(x = 5, y = 20)119 self.address_entry.configure(width = 45)120 self.address_entry.place(x = 5, y = 65)121 self.p_nmbr_entry.configure(width = 45)122 self.p_nmbr_entry.place(x = 5, y = 110)123 self.nmbr_entry.configure(width = 45)124 self.nmbr_entry.place(x = 5, y = 155)125 self.room_type_label.place(x = 350, y = 200)126 self.dlx_rad.place(x = 75, y = 225)127 self.dlx_rad_.place(x = 95, y = 228 )128 self.nrml_rad.place(x = 250, y = 225)129 self.nrml_rad_.place(x = 270, y = 228)130 self.prsdt_rad.place(x = 425, y = 225)131 self.prsdt_rad_.place(x = 445, y = 228)132 self.jnt_rad.place(x = 600, y = 225)133 self.jnt_rad_.place(x = 620, y = 228)134 self.sumbit_buttton.place(x = 635, y = 365)135 elif self.settings.font == 'small':136 self.name_entry.configure(width = 55)137 self.name_entry.place(x = 0, y = 21)138 self.address_entry.configure(width = 55)139 self.address_entry.place(x = 0, y = 69)140 self.p_nmbr_entry.configure(width = 55)141 self.p_nmbr_entry.place(x = 0, y = 119)142 self.nmbr_entry.configure(width = 55)143 self.nmbr_entry.place(x = 0, y = 165)144 self.room_type_label.place(x = 350, y = 200)145 self.dlx_rad.place(x = 85, y = 225)146 self.dlx_rad_.place(x = 105, y = 227 )147 self.nrml_rad.place(x = 260, y = 225)148 self.nrml_rad_.place(x = 280, y = 227)149 self.prsdt_rad.place(x = 435, y = 225)150 self.prsdt_rad_.place(x = 455, y = 227)151 self.jnt_rad.place(x = 610, y = 225)152 self.jnt_rad_.place(x = 630, y = 227)153 self.sumbit_buttton.place(x = 685, y = 375)154 def check_out(self):155 self.settings.load_data()156 guest_name = self.name.get()157 guest_address = self.address.get()158 guset_phone = self.p_nmbr.get()159 room_type = self.room_type.get()160 no_room = self.nmbr.get()161 if room_type == 1:162 room_type = 'Delux'163 elif room_type == 2:164 room_type = 'Normal'165 elif room_type == 3:166 room_type = 'President'167 elif room_type == 4:168 room_type = 'Joint'169 self.check_filled()170 print(self.filled)171 if self.filled == True:172 cnt = 0173 room = f'{room_type}-{no_room}'174 for guest in self.settings.guest:175 for key, value in guest.items():176 if room == key:177 print('WORKSS')178 name_ = value.get('name')179 address_ = value.get('address')180 phone_ = value.get('p_nmbr')181 if name_ == guest_name and address_ == guest_address and phone_ == guset_phone:182 self.delete = True183 del self.settings.guest[cnt]184 self.settings.save_data()185 Msg.showinfo("Hotel Management", "Check Out Successed")186 self.app.check_out_page()187 else:188 cnt +=1189 if self.delete == False :190 Msg.showwarning("Hotel Management", "Guest doesn't exists")191 else:192 Msg.showwarning("Hotel Management", "Please Fill The Forum")193 def check_filled(self):194 guest_name = self.name.get()195 guest_address = self.address.get()196 guset_phone = self.p_nmbr.get()197 room_type = self.room_type.get()198 no_room = self.nmbr.get()199 if guest_name == '' or guest_address == '' or guset_phone == '' or room_type == '' or no_room == '' :200 self.filled = False201 else:...

Full Screen

Full Screen

MainPage.py

Source:MainPage.py Github

copy

Full Screen

1#!/usr/bin/python2# -*- coding:UTF-8 -*-3import tkinter as tk4from view import AboutFrame,ModifyFrame,InsertFrame,SearchFrame,DeleteFrame,SortFrame,TotalFrame,ContentFrame5# 主页6class MainPage:7 def __init__(self,master:tk.Tk):8 self.root = master9 self.root.title('学生信息管理系统')10 self.root.geometry('600x400')11 self.create_page()12 def create_page(self):13 self.about_frame = AboutFrame(self.root)14 self.modify_frame = ModifyFrame(self.root)15 self.insert_frame = InsertFrame(self.root)16 self.search_frame = SearchFrame(self.root)17 self.delete_frame = DeleteFrame(self.root)18 self.sort_frame = SortFrame(self.root)19 self.total_frame = TotalFrame(self.root)20 self.content_frame = ContentFrame(self.root)21 menubar = tk.Menu(self.root)22 menubar.add_command(label='录入',command=self.show_insert)23 menubar.add_command(label='查询',command=self.show_search)24 menubar.add_command(label='删除',command=self.show_delete)25 menubar.add_command(label='修改',command=self.show_modify)26 menubar.add_command(label='排序',command=self.show_sort)27 menubar.add_command(label='统计',command=self.show_total)28 menubar.add_command(label='概览',command=self.show_content)29 menubar.add_command(label='关于',command=self.show_about)30 self.root['menu'] = menubar31 def show_about(self):32 self.about_frame.pack()33 self.modify_frame.pack_forget()34 self.insert_frame.pack_forget()35 self.search_frame.pack_forget()36 self.delete_frame.pack_forget()37 self.sort_frame.pack_forget()38 self.total_frame.pack_forget()39 self.content_frame.pack_forget()40 def show_insert(self):41 self.about_frame.pack_forget()42 self.modify_frame.pack_forget()43 self.insert_frame.pack()44 self.search_frame.pack_forget()45 self.delete_frame.pack_forget()46 self.sort_frame.pack_forget()47 self.total_frame.pack_forget()48 self.content_frame.pack_forget()49 pass50 def show_search(self):51 self.about_frame.pack_forget()52 self.modify_frame.pack_forget()53 self.insert_frame.pack_forget()54 self.search_frame.pack()55 self.delete_frame.pack_forget()56 self.sort_frame.pack_forget()57 self.total_frame.pack_forget()58 self.content_frame.pack_forget()59 pass60 def show_delete(self):61 self.about_frame.pack_forget()62 self.modify_frame.pack_forget()63 self.insert_frame.pack_forget()64 self.search_frame.pack_forget()65 self.delete_frame.pack()66 self.sort_frame.pack_forget()67 self.total_frame.pack_forget()68 self.content_frame.pack_forget()69 pass70 def show_modify(self):71 self.about_frame.pack_forget()72 self.modify_frame.pack()73 self.insert_frame.pack_forget()74 self.search_frame.pack_forget()75 self.delete_frame.pack_forget()76 self.sort_frame.pack_forget()77 self.total_frame.pack_forget()78 self.content_frame.pack_forget()79 pass80 def show_sort(self):81 self.about_frame.pack_forget()82 self.modify_frame.pack_forget()83 self.insert_frame.pack_forget()84 self.search_frame.pack_forget()85 self.delete_frame.pack_forget()86 self.sort_frame.pack()87 self.total_frame.pack_forget()88 self.content_frame.pack_forget()89 pass90 def show_total(self):91 self.about_frame.pack_forget()92 self.modify_frame.pack_forget()93 self.insert_frame.pack_forget()94 self.search_frame.pack_forget()95 self.delete_frame.pack_forget()96 self.sort_frame.pack_forget()97 self.total_frame.pack()98 self.content_frame.pack_forget()99 pass100 def show_content(self):101 self.about_frame.pack_forget()102 self.modify_frame.pack_forget()103 self.insert_frame.pack_forget()104 self.search_frame.pack_forget()105 self.delete_frame.pack_forget()106 self.sort_frame.pack_forget()107 self.total_frame.pack_forget()108 self.content_frame.pack()109 pass110if __name__ == '__main__':111 root = tk.Tk()112 MainPage(master=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