def build_screenshot_canvas(self): """Build the screenshot canvas""" self.screenshot_canvas = ttk.Canvas(self.toplevel, cursor='tcross', autostyle=False) self.screenshot_data = ImageGrab.grab() self.screenshot_image = ImageTk.PhotoImage(self.screenshot_data) self.screenshot_canvas.create_image(0, 0, image=self.screenshot_image, anchor=NW) self.screenshot_canvas.pack(fill=BOTH, expand=YES)
def create_luminance_scale(self, master): """Create the color luminance canvas""" # widget dimensions height = xf = self.spectrum_point width = self.spectrum_width values = self.get_variables() canvas = ttk.Canvas(master, height=height, width=width) # add color points to scale for x, l in enumerate(range(0, width, xf)): lum = l / width * LUM fill = colorutils.update_hsl_value(color=values.hex, lum=lum, inmodel='hex', outmodel='hex') bbox = [x * xf, 0, (x * xf) + xf, height] tag = f'color{x}' canvas.create_rectangle(*bbox, fill=fill, width=0, tags=[tag]) canvas.bind("<B1-Motion>", self.on_luminance_interaction, add="+") canvas.bind("<Button-1>", self.on_luminance_interaction, add="+") return canvas
def create_spectrum(self, master): """Create the color spectrum canvas""" # canvas and point dimensions width = self.spectrum_width height = self.spectrum_height xf = yf = self.spectrum_point # create canvas widget and binding canvas = ttk.Canvas(master, width=width, height=height, cursor='tcross') canvas.bind("<B1-Motion>", self.on_spectrum_interaction, add="+") canvas.bind("<Button-1>", self.on_spectrum_interaction, add="+") # add color points for x, colorx in enumerate(range(0, width, xf)): for y, colory in enumerate(range(0, height, yf)): values = self.color_from_coords(colorx, colory) fill = values.hex bbox = [x * xf, y * yf, (x * xf) + xf, (y * yf) + yf] canvas.create_rectangle(*bbox, fill=fill, width=0) return canvas
def __init__(self, tk_parent, linkedin_conn): self.parent = tk_parent self.linkedin_conn = linkedin_conn self.search_results_df = pd.DataFrame() self.search_thread = None self.quick_search = True # Paned Window self.search_paned_window = ttk.PanedWindow(tk_parent, orient='horizontal') self.search_paned_window.pack(side='top', fill="both", expand=True, padx=10) ## Search fields Canvas/ScrolledFrame search_fields_canvas = ttk.Canvas(self.search_paned_window) search_fields_frame = ScrolledFrame(search_fields_canvas) search_fields_frame.pack(side='top', fill='both', expand=True, padx=5) search_fields_frame.hide_scrollbars() ### Load/Save search load_save_btn_frame = ttk.Frame(search_fields_frame) load_save_btn_frame.pack(pady=5, side='top', fill="x") load_search_btn = ttk.Button(load_save_btn_frame, text="Load param.") load_search_btn.pack(side='left') load_search_btn['command'] = self.load_search_config save_search_btn = ttk.Button(load_save_btn_frame, text="Save param.") save_search_btn.pack(side='right', padx=10) save_search_btn['command'] = self.save_search_config ### KW-Frame kw_frame = ttk.Frame(search_fields_frame) kw_frame.pack(pady=5, side='top', fill="x") ttk.Label(kw_frame, text="Keywords").pack(side='left') self.entry_keywords = ttk.Entry(kw_frame) self.entry_keywords.pack(side='left', padx=10, fill='x', expand=True) ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Radio Frame radio_frame = ttk.Frame(search_fields_frame) radio_frame.pack(side='top', fill="x", pady=5, expand=True) radio_frame.grid_columnconfigure(0,weight=0) radio_frame.grid_columnconfigure(1,weight=0) radio_frame.grid_columnconfigure(2,weight=1) #### Sort by ttk.Label(radio_frame, text="Sort by").grid(row=0, column=0, sticky='nwse') self.sort_by = ttk.StringVar(value="R") ttk.Radiobutton(radio_frame, text='Most recent', variable=self.sort_by, value="DD").grid(row=0, column=1, padx=10, sticky='nwse') ttk.Radiobutton(radio_frame, text='Most relevant', variable=self.sort_by, value="R").grid(row=0, column=2, padx=10, sticky='nwse') ttk.Separator(radio_frame, orient='horizontal').grid(row=1, columnspan=3, pady=5, sticky='nwse') #### Date Posted ttk.Label(radio_frame, text="Date Posted").grid(row=2, column=0, sticky='nwse', pady=5) self.date_posted = ttk.IntVar(value=365) # Days since job was posted ttk.Radiobutton(radio_frame, text='Past 24h', variable=self.date_posted, value=1).grid(row=3, column=1, padx=10, pady=4, sticky='nwse') ttk.Radiobutton(radio_frame, text='Past Week', variable=self.date_posted, value=7).grid(row=3, column=2, padx=10, pady=4, sticky='nwse') ttk.Radiobutton(radio_frame, text='Past Month', variable=self.date_posted, value=30).grid(row=4, column=1, padx=10, pady=4, sticky='nwse') ttk.Radiobutton(radio_frame, text='Any Time', variable=self.date_posted, value=365).grid(row=4, column=2, padx=10, pady=4, sticky='nwse') ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Experience exp_frame = ttk.Frame(search_fields_frame) exp_frame.pack(side='top', fill="x") exp_frame.grid_columnconfigure(0,weight=0) exp_frame.grid_columnconfigure(1,weight=0) exp_frame.grid_columnconfigure(2,weight=1) ttk.Label(exp_frame, text="Experience").grid(row=0, column=0, pady=4, sticky='nwse') intern_lvl_bool = ttk.BooleanVar() entry_lvl_bool = ttk.BooleanVar() associate_bool = ttk.BooleanVar() mid_senior_bool = ttk.BooleanVar() director_bool = ttk.BooleanVar() executive_bool = ttk.BooleanVar() self.exp_dict_list = [ {'bool_val': intern_lvl_bool, 'name': '1'}, {'bool_val': entry_lvl_bool, 'name': '2'}, {'bool_val': associate_bool, 'name': '3'}, {'bool_val': mid_senior_bool, 'name': '4'}, {'bool_val': director_bool, 'name': '5'}, {'bool_val': executive_bool, 'name': '6'}, ] ttk.Checkbutton(exp_frame, text="Internship", variable=intern_lvl_bool).grid(row=1, column=0, padx=5, pady=4, sticky='nwse') ttk.Checkbutton(exp_frame, text="Entry level", variable=entry_lvl_bool).grid(row=1, column=1, padx=5, pady=4, sticky='nwse') ttk.Checkbutton(exp_frame, text="Associate", variable=associate_bool).grid(row=1, column=2, padx=5, pady=4, sticky='nwse') ttk.Checkbutton(exp_frame, text="Mid-Senior level", variable=mid_senior_bool).grid(row=2, column=0, padx=5, pady=4, sticky='nwse') ttk.Checkbutton(exp_frame, text="Director", variable=director_bool).grid(row=2, column=1, padx=5, pady=4, sticky='nwse') ttk.Checkbutton(exp_frame, text="Executive", variable=executive_bool).grid(row=2, column=2, padx=5, pady=4, sticky='nwse') ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Company frame self.comp_frame = SearchFrame(search_fields_frame, title='Company', fetch_fct=lambda x: utils.extract_urn_dict_from_query_results(linkedin_conn[0].get_company_urn_ids, x)) self.comp_frame.pack(side='top', fill="x") ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Job Type job_type_frame = ttk.Frame(search_fields_frame) job_type_frame.pack(side='top', fill="x") job_type_frame.grid_columnconfigure(0,weight=0) job_type_frame.grid_columnconfigure(1,weight=0) job_type_frame.grid_columnconfigure(2,weight=1) ttk.Label(job_type_frame, text="Job Type").grid(row=0, column=0, pady=4, sticky='nwse') full_time_bool = ttk.BooleanVar() part_time_bool = ttk.BooleanVar() temporary_bool = ttk.BooleanVar() contract_bool = ttk.BooleanVar() volunteer_bool = ttk.BooleanVar() intern_type_bool = ttk.BooleanVar() other_type_bool = ttk.BooleanVar() self.job_type_dict_list = [ {'bool_val': full_time_bool, 'name': 'F'}, {'bool_val': part_time_bool, 'name': 'P'}, {'bool_val': temporary_bool, 'name': 'T'}, {'bool_val': contract_bool, 'name': 'C'}, {'bool_val': volunteer_bool, 'name': 'V'}, {'bool_val': intern_type_bool, 'name': 'I'}, {'bool_val': other_type_bool, 'name': 'O'}, ] ttk.Checkbutton(job_type_frame, text="Other", variable=other_type_bool).grid(row=0, column=2, padx=10, pady=4, sticky='nwse') ttk.Checkbutton(job_type_frame, text="Full-time", variable=full_time_bool).grid(row=1, column=0, padx=10, pady=4, sticky='nwse') ttk.Checkbutton(job_type_frame, text="Part-time", variable=part_time_bool).grid(row=1, column=1, padx=10, pady=4, sticky='nwse') ttk.Checkbutton(job_type_frame, text="Temporary", variable=temporary_bool).grid(row=1, column=2, padx=10, pady=4, sticky='nwse') ttk.Checkbutton(job_type_frame, text="Contract", variable=contract_bool).grid(row=2, column=0, padx=10, pady=4, sticky='nwse') ttk.Checkbutton(job_type_frame, text="Volunteer", variable=volunteer_bool).grid(row=2, column=1, padx=10, pady=4, sticky='nwse') ttk.Checkbutton(job_type_frame, text="Internship", variable=intern_type_bool).grid(row=2, column=2, padx=10, pady=4, sticky='nwse') ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Location Fallback self.loc_fallback_frame = SearchFrame(search_fields_frame, title='General Location', single_choice=True, fetch_fct=lambda x: utils.extract_urn_dict_from_query_results(linkedin_conn[0].get_geo_urn_ids, x), tooltip="Restrict the geographical area of the results. In the browser, your location will be recognized automatically and shown at the top of the search page close to the keyword field.") self.loc_fallback_frame.pack(side='top', fill="x") ### Location Frame self.loc_frame = SearchFrame(search_fields_frame, title='Location', fetch_fct=lambda x: utils.extract_urn_dict_from_query_results(linkedin_conn[0].get_geo_urn_ids, x)) self.loc_frame.pack(side='top', fill="x") ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Industry frame self.industry_frame = SearchFrame(search_fields_frame, title='Industry', fetch_fct=lambda x: utils.extract_urn_dict_from_query_results(linkedin_conn[0].get_industry_urn_ids, x)) self.industry_frame.pack(side='top', fill="x", pady=5) self.search_paned_window.add(search_fields_canvas) ## Table frame self.table_main_frame = ttk.Frame(tk_parent) # pandastable self.table_frame = ttk.Frame(self.table_main_frame, bootstyle="secondary", borderwidth=2) self.table_frame.pack(side="top", fill="both", expand=True) self.table = Table(self.table_frame, dataframe=pd.DataFrame(), showtoolbar=False, showstatusbar=True) utils.fit_table_style_to_theme(self.table, ttk.Style()) self.table.unbind_all("<Tab>") self.table.unbind_all("<Return>") self.table.show() self.search_paned_window.add(self.table_main_frame) # Buttons frame btn_frame = ttk.Frame(tk_parent) btn_frame.pack(padx=10, pady=10, side='top', fill="x") quick_search_btn = ttk.Button(btn_frame, text="Quick search") quick_search_btn.pack(side='left', padx=10) quick_search_btn['command'] = self.start_quick_search ToolTip(quick_search_btn, "This is a single request that will yield the same results as in the linkedin search bar. \ \nIt doesn't contain any personal details (only public IDs) \ \nYou're not likely to reach any search limit using this mode.") btn_sub_frame = ttk.Frame(btn_frame) btn_sub_frame.pack(side="left", fill="none", expand=True) start_search_btn = ttk.Button(btn_sub_frame, text="Deep Search", bootstyle='danger') start_search_btn.pack(side='left', padx=10) start_search_btn['command'] = self.start_deep_search ToolTip(start_search_btn, "Each search result will be fetched for additional information. \ \nDepending on the number of results and search frequency, this can trigger the linkedin limit \ after which you'll only be able to get 3 results per search until the end of the month.") # self.get_contact_info = ttk.BooleanVar() # contact_info_chk_btn = ttk.Checkbutton(btn_sub_frame, text="Fetch contact info", # variable=self.get_contact_info, bootstyle="danger") # contact_info_chk_btn.pack(side='left', padx=10) # ToolTip(contact_info_chk_btn, text=f"Fetch contact info by running one additional request per result.") self.export_to_file_btn = ttk.Button(btn_frame, text="Export to File", state="disabled") self.export_to_file_btn.pack(side='left', padx=10) self.export_to_file_btn['command'] = self.prepare_dataframe_and_save_to_xsl # Status frame self.status_frame = ttk.Frame(tk_parent) self.status_frame.pack(padx=10, pady=2, side='bottom', expand=False, fill="x") self.status_str = ttk.StringVar(value="") ttk.Label(self.status_frame, textvariable=self.status_str).pack(side='left', expand=False) ttk.Separator(tk_parent, orient='horizontal').pack(side='bottom', fill='x')
def __init__(self, isServer: bool = False): style = ttk.Style("cosmo") self._root = style.master self._root.title("FBImg") self._root.rowconfigure(0, weight=1) self._root.columnconfigure(0, weight=1) self._root.protocol("WM_DELETE_WINDOW", self.shutdown) self._imgCanvas = ttk.Canvas(self._root) self._imgCanvas.config(bg="light gray") self._imgCanvas.grid(row=0, column=0, sticky="nsew") self._imgCanvas_shape = (0, 0) opFrame = ttk.Frame(self._root) opFrame.grid(row=1, column=0, sticky="we") opFrame.columnconfigure(0, weight=1) val = lambda s: ValEntry.type_validator(int)(s) and int(s) > 0 imgFrame = ttk.Frame(opFrame) imgFrame.grid(row=0, column=0, sticky="we") ttk.Label(imgFrame, text="宽度").pack(side="left", pady=5) self.wEntry = ValEntry(val, imgFrame, width=5) self.wEntry.pack(side="left", pady=5) ttk.Label(imgFrame, text="高度").pack(side="left", pady=5) self.hEntry = ValEntry(val, imgFrame, width=5) self.hEntry.pack(side="left", pady=5) ttk.Button(imgFrame, text="应用", command=self._applySize).pack(side="left", padx=2, pady=5) self._pauseButton = ttk.Checkbutton(imgFrame, text="暂停", bootstyle=("success", "outline", "toolbutton")) self._pauseButton.pack(side="left", padx=5, pady=5) ttk.Label(imgFrame, text="保存路径").pack(side="left", pady=5) self._dirEntry = ttk.Entry(imgFrame, width=30) self._dirEntry.pack(side="left", pady=5) ttk.Button(imgFrame, text="选择", command=self._selectDir).pack(side="left", pady=5) self._saveButton = ttk.Button(imgFrame, text="保存", bootstyle=("success"), command=self.saveImg) self._saveButton.pack(side="left", padx=5, pady=5) self._recordButton = ttk.Checkbutton(imgFrame, text="录制", command=self._toggleRecord, bootstyle=("warning", "outline", "toolbutton")) self._recordButton.pack(side="left", pady=5) self._cntLabel = ttk.Label(imgFrame) self._cntLabel.pack(side="left", pady=5) self._client = FBServer() if isServer else FBClient() self._recv = FBRawRecv() self._client.registerRecvCallback(self._recv.input) self._recv.registerRecvCallback(self.updateData) self._imgLock = threading.Lock() self._dirLock = threading.Lock() self.loadConfig()
def __init__(self, tk_parent, linkedin_conn): self.parent = tk_parent self.linkedin_conn = linkedin_conn self.search_results_df = pd.DataFrame() self.search_thread = None self.quick_search = True # Paned Window self.search_paned_window = ttk.PanedWindow(tk_parent, orient='horizontal') self.search_paned_window.pack(side='top', fill="both", expand=True, padx=10) ## Search fields Canvas/ScrolledFrame search_fields_canvas = ttk.Canvas(self.search_paned_window) search_fields_frame = ScrolledFrame(search_fields_canvas) search_fields_frame.pack(side='top', fill='both', expand=True, padx=5) search_fields_frame.hide_scrollbars() ### Load/Save search load_save_btn_frame = ttk.Frame(search_fields_frame) load_save_btn_frame.pack(pady=5, side='top', fill="x") load_search_btn = ttk.Button(load_save_btn_frame, text="Load param.") load_search_btn.pack(side='left') load_search_btn['command'] = self.load_search_config save_search_btn = ttk.Button(load_save_btn_frame, text="Save param.") save_search_btn.pack(side='right', padx=10) save_search_btn['command'] = self.save_search_config ### Connections conn_frame = ttk.Frame(search_fields_frame) conn_frame.pack(pady=10, side='top', fill='x') conn_lbl = ttk.Label(conn_frame, text="Connections") conn_lbl.pack(side='left', expand=False) ToolTip(conn_lbl, text=f"Degree of Connection with the logged in user.") first_con = ttk.BooleanVar() second_con = ttk.BooleanVar() third_con = ttk.BooleanVar() self.con_dict_list = [{ 'bool_val': first_con, 'name': 'F' }, { 'bool_val': second_con, 'name': 'S' }, { 'bool_val': third_con, 'name': 'O' }] ttk.Checkbutton(conn_frame, text="1st", variable=first_con, bootstyle="primary").pack(side='left', padx=10) ttk.Checkbutton(conn_frame, text="2nd", variable=second_con, bootstyle="primary").pack(side='left', padx=10) ttk.Checkbutton(conn_frame, text="3rd+", variable=third_con, bootstyle="primary").pack(side='left', padx=10) ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Connection of self.conn_of_frame = SearchFrame( search_fields_frame, title='Connection of', single_choice=True, fetch_fct=lambda x: utils.extract_urn_dict_from_query_results( linkedin_conn[0].get_contact_urn_ids, x)) self.conn_of_frame.pack(side='top', fill="x") ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Location Frame self.loc_frame = SearchFrame( search_fields_frame, title='Location', fetch_fct=lambda x: utils.extract_urn_dict_from_query_results( linkedin_conn[0].get_geo_urn_ids, x)) self.loc_frame.pack(side='top', fill="x") ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Current Company frame self.current_comp_frame = SearchFrame( search_fields_frame, title='Current Company', fetch_fct=lambda x: utils.extract_urn_dict_from_query_results( linkedin_conn[0].get_company_urn_ids, x)) self.current_comp_frame.pack(side='top', fill="x") ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Past Company frame self.past_comp_frame = SearchFrame( search_fields_frame, title='Past Company', fetch_fct=lambda x: utils.extract_urn_dict_from_query_results( linkedin_conn[0].get_company_urn_ids, x)) self.past_comp_frame.pack(side='top', fill="x", pady=5) ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### School frame self.school_frame = SearchFrame( search_fields_frame, title='School', fetch_fct=lambda x: utils.extract_urn_dict_from_query_results( linkedin_conn[0].get_school_urn_ids, x)) self.school_frame.pack(side='top', fill="x", pady=5) ttk.Separator(search_fields_frame, orient='horizontal').pack(side='top', fill='x', pady=5) ### Industry frame self.industry_frame = SearchFrame( search_fields_frame, title='Industry', fetch_fct=lambda x: utils.extract_urn_dict_from_query_results( linkedin_conn[0].get_industry_urn_ids, x)) self.industry_frame.pack(side='top', fill="x", pady=5) ### KW-Header kw_header_frame = ttk.Frame(search_fields_frame) kw_header_frame.pack(pady=5, side='top', fill="x") ttk.Label(kw_header_frame, text="Keywords").pack(side='left') ttk.Separator(kw_header_frame, orient='horizontal').pack(side='left', fill='x', expand=True) ### KW-Frame kw_frame = ttk.Frame(search_fields_frame) kw_frame.pack(pady=5, side='top', fill="x") kw_frame.grid_columnconfigure(0, weight=1) kw_frame.grid_columnconfigure(1, weight=1) kw_frame.grid_rowconfigure(0, weight=1) kw_frame.grid_rowconfigure(1, weight=1) kw_frame.grid_rowconfigure(2, weight=1) #### General self.entry_keywords = PlaceholderEntry(kw_frame, 'General') self.entry_keywords.grid(row=0, column=0, sticky='nwse', padx=5, pady=4) #### First Name self.entry_keywords_first_name = PlaceholderEntry( kw_frame, 'First Name') self.entry_keywords_first_name.grid(row=0, column=1, sticky='nwse', padx=5, pady=4) #### Last Name self.entry_keywords_last_name = PlaceholderEntry(kw_frame, 'Last Name') self.entry_keywords_last_name.grid(row=1, column=0, sticky='nwse', padx=5, pady=4) #### Title self.entry_keywords_title = PlaceholderEntry(kw_frame, 'Title') self.entry_keywords_title.grid(row=1, column=1, sticky='nwse', padx=5, pady=4) #### Company self.entry_keywords_company = PlaceholderEntry(kw_frame, 'Company') self.entry_keywords_company.grid(row=2, column=0, sticky='nwse', padx=5, pady=4) #### School self.entry_keywords_school = PlaceholderEntry(kw_frame, 'School') self.entry_keywords_school.grid(row=2, column=1, sticky='nwse', padx=5, pady=4) self.search_paned_window.add(search_fields_canvas) ## Table frame self.table_main_frame = ttk.Frame(tk_parent) # pandastable self.table_frame = ttk.Frame(self.table_main_frame, bootstyle="secondary", borderwidth=2) self.table_frame.pack(side="top", fill="both", expand=True) self.table = Table(self.table_frame, dataframe=pd.DataFrame(), showtoolbar=False, showstatusbar=True) utils.fit_table_style_to_theme(self.table, ttk.Style()) self.table.unbind_all("<Tab>") self.table.unbind_all("<Return>") self.table.show() self.search_paned_window.add(self.table_main_frame) # Buttons frame btn_frame = ttk.Frame(tk_parent) btn_frame.pack(padx=10, pady=10, side='top', fill="x") quick_search_btn = ttk.Button(btn_frame, text="Quick search") quick_search_btn.pack(side='left', padx=10) quick_search_btn['command'] = self.start_quick_search ToolTip( quick_search_btn, "This is a single request that will yield the same results as in the linkedin search bar. \ \nIt doesn't contain any personal details (only public IDs) \ \nYou're not likely to reach any search limit using this mode.") btn_sub_frame = ttk.Frame(btn_frame) btn_sub_frame.pack(side="left", fill="none", expand=True) start_search_btn = ttk.Button(btn_sub_frame, text="Deep Search", bootstyle='danger') start_search_btn.pack(side='left', padx=10) start_search_btn['command'] = self.start_deep_search ToolTip( start_search_btn, "Each search result will be fetched for additional information. \ \nDepending on the number of results and search frequency, this can trigger the linkedin limit \ after which you'll only be able to get 3 results per search until the end of the month." ) self.get_skills = ttk.BooleanVar() skills_chk_btn = ttk.Checkbutton(btn_sub_frame, text="Fetch skills", variable=self.get_skills, bootstyle="danger") skills_chk_btn.pack(side='left', padx=10) ToolTip( skills_chk_btn, text=f"Fetch skills by running one additional request per result.") self.get_contact_info = ttk.BooleanVar() contact_info_chk_btn = ttk.Checkbutton(btn_sub_frame, text="Fetch contact info", variable=self.get_contact_info, bootstyle="danger") contact_info_chk_btn.pack(side='left', padx=10) ToolTip( contact_info_chk_btn, text= f"Fetch contact info by running one additional request per result." ) self.export_to_file_btn = ttk.Button(btn_frame, text="Export to File", state="disabled") self.export_to_file_btn.pack(side='left', padx=10) self.export_to_file_btn[ 'command'] = self.prepare_dataframe_and_save_to_xsl # Status frame self.status_frame = ttk.Frame(tk_parent) self.status_frame.pack(padx=10, pady=2, side='bottom', expand=False, fill="x") self.status_str = ttk.StringVar(value="") ttk.Label(self.status_frame, textvariable=self.status_str).pack(side='left', expand=False) ttk.Separator(tk_parent, orient='horizontal').pack(side='bottom', fill='x')
def __init__(self, master, **kwargs): super().__init__(master, **kwargs) self.pack(fill=BOTH, expand=YES) # application images self.images = [ ttk.PhotoImage(name='logo', file=PATH / 'icons8_broom_64px_1.png'), ttk.PhotoImage(name='cleaner', file=PATH / 'icons8_broom_64px.png'), ttk.PhotoImage(name='registry', file=PATH / 'icons8_registry_editor_64px.png'), ttk.PhotoImage(name='tools', file=PATH / 'icons8_wrench_64px.png'), ttk.PhotoImage(name='options', file=PATH / 'icons8_settings_64px.png'), ttk.PhotoImage(name='privacy', file=PATH / 'icons8_spy_80px.png'), ttk.PhotoImage(name='junk', file=PATH / 'icons8_trash_can_80px.png'), ttk.PhotoImage(name='protect', file=PATH / 'icons8_protect_40px.png') ] # header hdr_frame = ttk.Frame(self, padding=20, bootstyle=SECONDARY) hdr_frame.grid(row=0, column=0, columnspan=3, sticky=EW) hdr_label = ttk.Label(master=hdr_frame, image='logo', bootstyle=(INVERSE, SECONDARY)) hdr_label.pack(side=LEFT) logo_text = ttk.Label(master=hdr_frame, text='pc cleaner', font=('TkDefaultFixed', 30), bootstyle=(INVERSE, SECONDARY)) logo_text.pack(side=LEFT, padx=10) # action buttons action_frame = ttk.Frame(self) action_frame.grid(row=1, column=0, sticky=NSEW) cleaner_btn = ttk.Button(master=action_frame, image='cleaner', text='cleaner', compound=TOP, bootstyle=INFO) cleaner_btn.pack(side=TOP, fill=BOTH, ipadx=10, ipady=10) registry_btn = ttk.Button(master=action_frame, image='registry', text='registry', compound=TOP, bootstyle=INFO) registry_btn.pack(side=TOP, fill=BOTH, ipadx=10, ipady=10) tools_btn = ttk.Button(master=action_frame, image='tools', text='tools', compound=TOP, bootstyle=INFO) tools_btn.pack(side=TOP, fill=BOTH, ipadx=10, ipady=10) options_btn = ttk.Button(master=action_frame, image='options', text='options', compound=TOP, bootstyle=INFO) options_btn.pack(side=TOP, fill=BOTH, ipadx=10, ipady=10) # option notebook notebook = ttk.Notebook(self) notebook.grid(row=1, column=1, sticky=NSEW, pady=(25, 0)) # windows tab windows_tab = ttk.Frame(notebook, padding=10) wt_scrollbar = ttk.Scrollbar(windows_tab) wt_scrollbar.pack(side=RIGHT, fill=Y) wt_scrollbar.set(0, 1) wt_canvas = ttk.Canvas(master=windows_tab, relief=FLAT, borderwidth=0, selectborderwidth=0, highlightthickness=0, yscrollcommand=wt_scrollbar.set) wt_canvas.pack(side=LEFT, fill=BOTH) # adjust the scrollregion when the size of the canvas changes wt_canvas.bind(sequence='<Configure>', func=lambda e: wt_canvas.configure(scrollregion= wt_canvas.bbox(ALL))) wt_scrollbar.configure(command=wt_canvas.yview) scroll_frame = ttk.Frame(wt_canvas) wt_canvas.create_window((0, 0), window=scroll_frame, anchor=NW) radio_options = [ 'Internet Cache', 'Internet History', 'Cookies', 'Download History', 'Last Download Location', 'Session', 'Set Aside Tabs', 'Recently Typed URLs', 'Saved Form Information', 'Saved Password' ] edge = ttk.Labelframe(master=scroll_frame, text='Microsoft Edge', padding=(20, 5)) edge.pack(fill=BOTH, expand=YES, padx=20, pady=10) explorer = ttk.Labelframe(master=scroll_frame, text='Internet Explorer', padding=(20, 5)) explorer.pack(fill=BOTH, padx=20, pady=10, expand=YES) # add radio buttons to each label frame section for section in [edge, explorer]: for opt in radio_options: cb = ttk.Checkbutton(section, text=opt, state=NORMAL) cb.invoke() cb.pack(side=TOP, pady=2, fill=X) notebook.add(windows_tab, text='windows') # empty tab for looks notebook.add(ttk.Frame(notebook), text='applications') # results frame results_frame = ttk.Frame(self) results_frame.grid(row=1, column=2, sticky=NSEW) # progressbar with text indicator pb_frame = ttk.Frame(results_frame, padding=(0, 10, 10, 10)) pb_frame.pack(side=TOP, fill=X, expand=YES) pb = ttk.Progressbar(master=pb_frame, bootstyle=(SUCCESS, STRIPED), variable='progress') pb.pack(side=LEFT, fill=X, expand=YES, padx=(15, 10)) ttk.Label(pb_frame, text='%').pack(side=RIGHT) ttk.Label(pb_frame, textvariable='progress').pack(side=RIGHT) self.setvar('progress', 78) # result cards cards_frame = ttk.Frame(master=results_frame, name='cards-frame', bootstyle=SECONDARY) cards_frame.pack(fill=BOTH, expand=YES) # privacy card priv_card = ttk.Frame( master=cards_frame, padding=1, ) priv_card.pack(side=LEFT, fill=BOTH, padx=(10, 5), pady=10) priv_container = ttk.Frame( master=priv_card, padding=40, ) priv_container.pack(fill=BOTH, expand=YES) priv_lbl = ttk.Label(master=priv_container, image='privacy', text='PRIVACY', compound=TOP, anchor=CENTER) priv_lbl.pack(fill=BOTH, padx=20, pady=(40, 0)) ttk.Label(master=priv_container, textvariable='priv_lbl', bootstyle=PRIMARY).pack(pady=(0, 20)) self.setvar('priv_lbl', '6025 tracking file(s) removed') # junk card junk_card = ttk.Frame( master=cards_frame, padding=1, ) junk_card.pack(side=LEFT, fill=BOTH, padx=(5, 10), pady=10) junk_container = ttk.Frame(junk_card, padding=40) junk_container.pack(fill=BOTH, expand=YES) junk_lbl = ttk.Label( master=junk_container, image='junk', text='PRIVACY', compound=TOP, anchor=CENTER, ) junk_lbl.pack(fill=BOTH, padx=20, pady=(40, 0)) ttk.Label(master=junk_container, textvariable='junk_lbl', bootstyle=PRIMARY, justify=CENTER).pack(pady=(0, 20)) self.setvar('junk_lbl', '1,150 MB of unneccesary file(s)\nremoved') # user notification note_frame = ttk.Frame(master=results_frame, bootstyle=SECONDARY, padding=40) note_frame.pack(fill=BOTH) note_msg = ttk.Label( master=note_frame, text='We recommend that you better protect your data', anchor=CENTER, font=('Helvetica', 12, 'italic'), bootstyle=(INVERSE, SECONDARY)) note_msg.pack(fill=BOTH)
def build_zoom_toplevel(self, master): """Build the toplevel widget that shows the zoomed version of the pixels underneath the mouse cursor.""" height = utility.scale_size(self.toplevel, 100) width = utility.scale_size(self.toplevel, 100) text_xoffset = utility.scale_size(self.toplevel, 50) text_yoffset = utility.scale_size(self.toplevel, 50) toplevel = ttk.Toplevel(master) toplevel.transient(master) if self.toplevel.winsys == 'x11': toplevel.attributes('-type', 'tooltip') else: toplevel.overrideredirect(True) toplevel.geometry(f'{width}x{height}') toplevel.lift() self.zoom_canvas = ttk.Canvas(toplevel, borderwidth=1, height=self.zoom_height, width=self.zoom_width) self.zoom_canvas.create_image(0, 0, tags=['image'], anchor=NW) self.zoom_canvas.create_text(text_xoffset, text_yoffset, text="+", fill="white", tags=['indicator']) self.zoom_canvas.pack(fill=BOTH, expand=YES) self.zoom_toplevel = toplevel