def create_entry_test(bootstyle, style): frame = ttk.Frame(padding=10) # title title = ttk.Label(frame, text='Entry', anchor=tk.CENTER) title.pack(padx=5, pady=2, fill=tk.BOTH) ttk.Separator(frame).pack(padx=5, pady=5, fill=tk.X) # default entry = ttk.Entry(frame, bootstyle=bootstyle) entry.pack(padx=5, pady=5, fill=tk.BOTH) entry.insert(tk.END, 'default') # color for color in style.theme.colors: entry = ttk.Entry(frame, bootstyle=color) entry.pack(padx=5, pady=5, fill=tk.BOTH) entry.insert(tk.END, color) # readonly entry = ttk.Entry(frame, bootstyle=bootstyle) entry.insert(tk.END, 'readonly') entry.configure(state=READONLY) entry.pack(padx=5, pady=5, fill=tk.BOTH) # disabled entry = ttk.Entry(frame, bootstyle=bootstyle) entry.insert(tk.END, 'disabled') entry.configure(state=DISABLED) entry.pack(padx=5, pady=5, fill=tk.BOTH) return frame
def body(self, master): master.pack_configure(fill="x", expand=True) master.grid_columnconfigure(1, weight=1) WIDTH = 100 ttk.Label(master, text="名称").grid(row=0, column=0) self.nameEntry = ttk.Entry(master, width=WIDTH) self.nameEntry.grid(row=0, column=1, sticky="ew") ttk.Label(master, text="指令").grid(row=1, column=0) self.cmdEntry = ttk.Entry(master, width=WIDTH) self.cmdEntry.grid(row=1, column=1, sticky="ew") ttk.Label(master, text="变量").grid(row=2, column=0) self.varEntry = ttk.Entry(master, width=WIDTH) self.varEntry.grid(row=2, column=1, sticky="ew") ttk.Label(master, text="绑定").grid(row=3, column=0) self.bindEntry = ttk.Entry(master, width=WIDTH) self.bindEntry.grid(row=3, column=1, sticky="ew") for i, entry in enumerate( (self.nameEntry, self.cmdEntry, self.varEntry, self.bindEntry)): entry.insert("end", self.default[i]) f = (self.nameEntry, self.cmdEntry, self.varEntry, self.bindEntry)[self.focus] f.select_range(0, "end") return f
def setup_theme_creator(self): # application menu self.menu = ttk.Menu() self.menu.add_command(label="Save", command=self.save_theme) self.menu.add_command(label="Reset", command=self.change_base_theme) self.menu.add_command(label="Import", command=self.import_user_themes) self.menu.add_command(label="Export", command=self.export_user_themes) self.configure(menu=self.menu) # theme configuration settings ## user theme name f1 = ttk.Frame(self.configure_frame, padding=(5, 2)) ttk.Label(f1, text="name", width=12).pack(side=LEFT) self.theme_name = ttk.Entry(f1) self.theme_name.insert(END, "new theme") self.theme_name.pack(side=LEFT, fill=X, expand=YES) f1.pack(fill=X, expand=YES) ## base theme f2 = ttk.Frame(self.configure_frame, padding=(5, 2)) ttk.Label(f2, text="base theme", width=12).pack(side=LEFT) self.base_theme = ttk.Combobox(f2, values=self.style.theme_names()) self.base_theme.insert(END, "litera") self.base_theme.pack(side=LEFT, fill=X, expand=YES) f2.pack(fill=X, expand=YES, pady=(0, 15)) self.base_theme.bind("<<ComboboxSelected>>", self.change_base_theme) ## color options self.color_rows = [] for color in self.style.colors.label_iter(): row = ColorRow(self.configure_frame, color, self.style) self.color_rows.append(row) row.pack(fill=BOTH, expand=YES) row.bind("<<ColorSelected>>", self.create_temp_theme)
def construct(self, frame: ttk.Frame) -> None: self.data.setdefault("text", tk.StringVar()) self.label = ttk.Label(frame, text=self.name) self.entry = ttk.Entry(frame, textvariable=self.data["text"]) self.entry.bind("<Return>", lambda _: self._callback("enter")) self.label.pack(side="left") self.entry.pack(side="left")
def __init__(self, master, color, style): super().__init__(master, padding=(5, 2)) self.colorname = color self.style = style self.label = ttk.Label(self, text=color, width=12) self.label.pack(side=LEFT) self.patch = Frame(master=self, background=self.style.colors.get(color), width=15) self.patch.pack(side=LEFT, fill=BOTH, padx=2) self.entry = ttk.Entry(self, width=12) self.entry.pack(side=LEFT, fill=X, expand=YES) self.entry.bind("<FocusOut>", self.enter_color) self.color_picker = ttk.Button( master=self, text="...", bootstyle=SECONDARY, command=self.pick_color, ) self.color_picker.pack(side=LEFT, padx=2) # set initial color value and patch color self.color_value = self.style.colors.get(color) self.update_patch_color()
def create_form_entry(self, label, variable): """Create a single form entry""" container = ttk.Frame(self) container.pack(fill=X, expand=YES, pady=5) lbl = ttk.Label(master=container, text=label.title(), width=10) lbl.pack(side=LEFT, padx=5) ent = ttk.Entry(master=container, textvariable=variable) ent.pack(side=LEFT, padx=5, fill=X, expand=YES)
def create_path_row(self): """Add path row to labelframe""" path_row = ttk.Frame(self.option_lf) path_row.pack(fill=X, expand=YES) path_lbl = ttk.Label(path_row, text="Path", width=8) path_lbl.pack(side=LEFT, padx=(15, 0)) path_ent = ttk.Entry(path_row, textvariable=self.path_var) path_ent.pack(side=LEFT, fill=X, expand=YES, padx=5) browse_btn = ttk.Button(master=path_row, text="Browse", command=self.on_browse, width=8) browse_btn.pack(side=LEFT, padx=5)
def create_term_row(self): """Add term row to labelframe""" term_row = ttk.Frame(self.option_lf) term_row.pack(fill=X, expand=YES, pady=15) term_lbl = ttk.Label(term_row, text="Term", width=8) term_lbl.pack(side=LEFT, padx=(15, 0)) term_ent = ttk.Entry(term_row, textvariable=self.term_var) term_ent.pack(side=LEFT, fill=X, expand=YES, padx=5) search_btn = ttk.Button(master=term_row, text="Search", command=self.on_search, bootstyle=OUTLINE, width=8) search_btn.pack(side=LEFT, padx=5)
def setup_demo(master): ZEN = """Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!""" root = ttk.Frame(master, padding=10) style = ttk.Style() theme_names = style.theme_names() theme_selection = ttk.Frame(root, padding=(10, 10, 10, 0)) theme_selection.pack(fill=X, expand=YES) theme_selected = ttk.Label(master=theme_selection, text="litera", font="-size 24 -weight bold") theme_selected.pack(side=LEFT) lbl = ttk.Label(theme_selection, text="Select a theme:") theme_cbo = ttk.Combobox( master=theme_selection, text=style.theme.name, values=theme_names, ) theme_cbo.pack(padx=10, side=RIGHT) theme_cbo.current(theme_names.index(style.theme.name)) lbl.pack(side=RIGHT) ttk.Separator(root).pack(fill=X, pady=10, padx=10) def change_theme(e): t = cbo.get() style.theme_use(t) theme_selected.configure(text=t) theme_cbo.selection_clear() default.focus_set() theme_cbo.bind("<<ComboboxSelected>>", change_theme) lframe = ttk.Frame(root, padding=5) lframe.pack(side=LEFT, fill=BOTH, expand=YES) rframe = ttk.Frame(root, padding=5) rframe.pack(side=RIGHT, fill=BOTH, expand=YES) color_group = ttk.Labelframe(master=lframe, text="Theme color options", padding=10) color_group.pack(fill=X, side=TOP) for color in style.colors: cb = ttk.Button(color_group, text=color, bootstyle=color) cb.pack(side=LEFT, expand=YES, padx=5, fill=X) rb_group = ttk.Labelframe(lframe, text="Checkbuttons & radiobuttons", padding=10) rb_group.pack(fill=X, pady=10, side=TOP) check1 = ttk.Checkbutton(rb_group, text="selected") check1.pack(side=LEFT, expand=YES, padx=5) check1.invoke() check2 = ttk.Checkbutton(rb_group, text="alternate") check2.pack(side=LEFT, expand=YES, padx=5) check4 = ttk.Checkbutton(rb_group, text="deselected") check4.pack(side=LEFT, expand=YES, padx=5) check4.invoke() check4.invoke() check3 = ttk.Checkbutton(rb_group, text="disabled", state=DISABLED) check3.pack(side=LEFT, expand=YES, padx=5) radio1 = ttk.Radiobutton(rb_group, text="selected", value=1) radio1.pack(side=LEFT, expand=YES, padx=5) radio1.invoke() radio2 = ttk.Radiobutton(rb_group, text="deselected", value=2) radio2.pack(side=LEFT, expand=YES, padx=5) radio3 = ttk.Radiobutton(master=rb_group, text="disabled", value=3, state=DISABLED) radio3.pack(side=LEFT, expand=YES, padx=5) ttframe = ttk.Frame(lframe) ttframe.pack(pady=5, fill=X, side=TOP) table_data = [ ("South Island, New Zealand", 1), ("Paris", 2), ("Bora Bora", 3), ("Maui", 4), ("Tahiti", 5), ] tv = ttk.Treeview(master=ttframe, columns=[0, 1], show=HEADINGS, height=5) for row in table_data: tv.insert("", END, values=row) tv.selection_set("I001") tv.heading(0, text="City") tv.heading(1, text="Rank") tv.column(0, width=300) tv.column(1, width=70, anchor=CENTER) tv.pack(side=LEFT, anchor=NE, fill=X) # # notebook with table and text tabs nb = ttk.Notebook(ttframe) nb.pack(side=LEFT, padx=(10, 0), expand=YES, fill=BOTH) nb_text = "This is a notebook tab.\nYou can put any widget you want here." nb.add(ttk.Label(nb, text=nb_text), text="Tab 1", sticky=NW) nb.add(child=ttk.Label(nb, text="A notebook tab."), text="Tab 2", sticky=NW) nb.add(ttk.Frame(nb), text="Tab 3") nb.add(ttk.Frame(nb), text="Tab 4") nb.add(ttk.Frame(nb), text="Tab 5") # text widget txt = ScrolledText(master=lframe, height=5, width=50, autohide=True) txt.insert(END, ZEN) txt.pack(side=LEFT, anchor=NW, pady=5, fill=BOTH, expand=YES) lframe_inner = ttk.Frame(lframe) lframe_inner.pack(fill=BOTH, expand=YES, padx=10) s1 = ttk.Scale(master=lframe_inner, orient=HORIZONTAL, value=75, from_=100, to=0) s1.pack(fill=X, pady=5, expand=YES) ttk.Progressbar( master=lframe_inner, orient=HORIZONTAL, value=50, ).pack(fill=X, pady=5, expand=YES) ttk.Progressbar( master=lframe_inner, orient=HORIZONTAL, value=75, bootstyle=(SUCCESS, STRIPED), ).pack(fill=X, pady=5, expand=YES) m = ttk.Meter( master=lframe_inner, metersize=150, amountused=45, subtext="meter widget", bootstyle=INFO, interactive=True, ) m.pack(pady=10) sb = ttk.Scrollbar( master=lframe_inner, orient=HORIZONTAL, ) sb.set(0.1, 0.9) sb.pack(fill=X, pady=5, expand=YES) sb = ttk.Scrollbar(master=lframe_inner, orient=HORIZONTAL, bootstyle=(DANGER, ROUND)) sb.set(0.1, 0.9) sb.pack(fill=X, pady=5, expand=YES) btn_group = ttk.Labelframe(master=rframe, text="Buttons", padding=(10, 5)) btn_group.pack(fill=X) menu = ttk.Menu(root) for i, t in enumerate(style.theme_names()): menu.add_radiobutton(label=t, value=i) default = ttk.Button(master=btn_group, text="solid button") default.pack(fill=X, pady=5) default.focus_set() mb = ttk.Menubutton( master=btn_group, text="solid menubutton", bootstyle=SECONDARY, menu=menu, ) mb.pack(fill=X, pady=5) cb = ttk.Checkbutton( master=btn_group, text="solid toolbutton", bootstyle=(SUCCESS, TOOLBUTTON), ) cb.invoke() cb.pack(fill=X, pady=5) ob = ttk.Button( master=btn_group, text="outline button", bootstyle=(INFO, OUTLINE), command=lambda: Messagebox.ok("You pushed an outline button"), ) ob.pack(fill=X, pady=5) mb = ttk.Menubutton( master=btn_group, text="outline menubutton", bootstyle=(WARNING, OUTLINE), menu=menu, ) mb.pack(fill=X, pady=5) cb = ttk.Checkbutton( master=btn_group, text="outline toolbutton", bootstyle=(SUCCESS, OUTLINE, TOOLBUTTON), ) cb.pack(fill=X, pady=5) lb = ttk.Button(master=btn_group, text="link button", bootstyle=LINK) lb.pack(fill=X, pady=5) cb1 = ttk.Checkbutton( master=btn_group, text="rounded toggle", bootstyle=(SUCCESS, ROUND, TOGGLE), ) cb1.invoke() cb1.pack(fill=X, pady=5) cb2 = ttk.Checkbutton(master=btn_group, text="squared toggle", bootstyle=(SQUARE, TOGGLE)) cb2.pack(fill=X, pady=5) cb2.invoke() input_group = ttk.Labelframe(master=rframe, text="Other input widgets", padding=10) input_group.pack(fill=BOTH, pady=(10, 5), expand=YES) entry = ttk.Entry(input_group) entry.pack(fill=X) entry.insert(END, "entry widget") password = ttk.Entry(master=input_group, show="•") password.pack(fill=X, pady=5) password.insert(END, "password") spinbox = ttk.Spinbox(master=input_group, from_=0, to=100) spinbox.pack(fill=X) spinbox.set(45) cbo = ttk.Combobox( master=input_group, text=style.theme.name, values=theme_names, exportselection=False, ) cbo.pack(fill=X, pady=5) cbo.current(theme_names.index(style.theme.name)) de = ttk.DateEntry(input_group) de.pack(fill=X) return root
def create_value_inputs(self, master): """Create color value input widgets""" container = ttk.Frame(master) for x in range(4): container.columnconfigure(x, weight=1) # value labels lbl_cnf = {'master': container, 'anchor': E} ttk.Label(**lbl_cnf, text=f'''{MessageCatalog.translate('Hue')}:''').grid( row=0, column=0, sticky=E) ttk.Label(**lbl_cnf, text=f'''{MessageCatalog.translate('Sat')}:''').grid( row=1, column=0, sticky=E) ttk.Label(**lbl_cnf, text=f'''{MessageCatalog.translate('Lum')}:''').grid( row=2, column=0, sticky=E) ttk.Label(**lbl_cnf, text=f'''{MessageCatalog.translate('Hex')}:''').grid( row=3, column=0, sticky=E) ttk.Label(**lbl_cnf, text=f'''{MessageCatalog.translate('Red')}:''').grid( row=0, column=2, sticky=E) ttk.Label(**lbl_cnf, text=f'''{MessageCatalog.translate('Green')}:''').grid( row=1, column=2, sticky=E) ttk.Label(**lbl_cnf, text=f'''{MessageCatalog.translate('Blue')}:''').grid( row=2, column=2, sticky=E) # value spinners and entry widgets rgb_cnf = {'master': container, 'from_': 0, 'to': 255, 'width': 3} sl_cnf = {'master': container, 'from_': 0, 'to': 100, 'width': 3} hue_cnf = {'master': container, 'from_': 0, 'to': 360, 'width': 3} sb_hue = ttk.Spinbox(**hue_cnf, textvariable=self.hue) sb_hue.grid(row=0, column=1, padx=4, pady=2, sticky=EW) sb_sat = ttk.Spinbox(**sl_cnf, textvariable=self.sat) sb_sat.grid(row=1, column=1, padx=4, pady=2, sticky=EW) sb_lum = ttk.Spinbox(**sl_cnf, textvariable=self.lum) sb_lum.grid(row=2, column=1, padx=4, pady=2, sticky=EW) sb_red = ttk.Spinbox(**rgb_cnf, textvariable=self.red) sb_red.grid(row=0, column=3, padx=4, pady=2, sticky=EW) sb_grn = ttk.Spinbox(**rgb_cnf, textvariable=self.grn) sb_grn.grid(row=1, column=3, padx=4, pady=2, sticky=EW) sb_blu = ttk.Spinbox(**rgb_cnf, textvariable=self.blu) sb_blu.grid(row=2, column=3, padx=4, pady=2, sticky=EW) ent_hex = ttk.Entry(container, textvariable=self.hex) ent_hex.grid(row=3, column=1, padx=4, columnspan=3, pady=2, sticky=EW) # add input validation add_validation(ent_hex, validate_color) add_range_validation(sb_hue, 0, 360) for sb in [sb_sat, sb_lum]: add_range_validation(sb, 0, 100) for sb in [sb_red, sb_grn, sb_blu]: add_range_validation(sb, 0, 255) # event binding for updating colors on value change for sb in [sb_hue, sb_sat, sb_lum]: for sequence in [ '<<Increment>>', '<<Decrement>>', '<Return>', '<KP_Enter>' ]: sb.bind( sequence=sequence, func=lambda _, w=sb: self.on_entry_value_change(w, HSL), add="+") for sb in [sb_red, sb_grn, sb_blu]: for sequence in [ '<<Increment>>', '<<Decrement>>', '<Return>', '<KP_Enter>' ]: sb.bind( sequence=sequence, func=lambda _, w=sb: self.on_entry_value_change(w, RGB), add="+") for sequence in ['<Return>', '<KP_Enter>']: ent_hex.bind( sequence=sequence, func=lambda _, w=ent_hex: self.on_entry_value_change(w, HEX), add="+") return container
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')
self.status_str.set("Table could not be saved!") if __name__ == "__main__": from linkedin_api import Linkedin root = ttk.Window() root.title("LinkedIn Job Search") root.geometry("1280x720") # Login frame login_frame = ttk.Frame(root) login_frame.pack(pady=10, expand=False, fill="x") ttk.Label(login_frame, text="User").pack(side='left', expand=False, padx=5) entry_usr = ttk.Entry(login_frame) entry_usr.pack(side='left', expand=True, fill="x", padx=5) ttk.Label(login_frame, text="Pwd").pack(side='left', expand=False, padx=5) entry_pwd = ttk.Entry(login_frame, show="*") entry_pwd.pack(side='left', expand=True, fill="x", padx=5) connect_btn = ttk.Button(login_frame, text="Connect") connect_btn.pack(side='left', padx=5) linkedin_conn = [None] def connect_linkedin(): # Authenticate using any Linkedin account credentials try: linkedin_conn[0] = Linkedin(entry_usr.get(), entry_pwd.get())
#endregion #region Tk Interface widgets button_install = TkBootstrap.Button(text="start install", bootstyle='success', command=Install) button_path = TkBootstrap.Button(text="select source folder", bootstyle='default', command=SelectDirectory) checkButton_denoiser = TkBootstrap.Checkbutton( text="add denoising", bootstyle='outline-toolbutton') checkButton_settings = TkBootstrap.Checkbutton( text="copy settings", bootstyle='outline-toolbutton') entry_path = TkBootstrap.Entry(text="root directory", bootstyle='default') label_info = TkBootstrap.Label(text="Wicked Engine folder:") #endregion #region Window changes, widget packing/placing, etc. window.geometry(str(screenWidth) + 'x' + str(screenHeight)) # Needs to be strings for some reason? button_install.place(relx=0.5, rely=0.75, anchor=CENTER) button_path.place(relx=0.5, rely=0.5, anchor=CENTER) # These two lines are up to the package maintainer to use or not! #checkButton_denoiser.place(relx = 0.25, rely = 0.325, anchor = CENTER) #checkButton_settings.place(relx = 0.25, rely = 0.650, anchor = CENTER)
return False def validate_alpha(x) -> bool: """Validates that the input is alpha""" if x.isdigit(): return False elif x == "": return True else: return True # create the toplevel window root = ttk.Window() frame = ttk.Frame(root, padding=10) frame.pack(fill=BOTH, expand=YES) # register the validation callback digit_func = root.register(validate_number) alpha_func = root.register(validate_alpha) # validate numeric entry ttk.Label(frame, text="Enter a number").pack() num_entry = ttk.Entry(frame, validate="focus", validatecommand=(digit_func, '%P')) num_entry.pack(padx=10, pady=10, expand=True) # validate alpha entry ttk.Label(frame, text="Enter a letter").pack() let_entry = ttk.Entry(frame, validate="focus", validatecommand=(alpha_func, '%P')) let_entry.pack(padx=10, pady=10, expand=True) root.mainloop()
def create_right_frame(self): container = ttk.Frame(self) container.pack(side=RIGHT, fill=BOTH, expand=YES, padx=5) # demonstrates various button styles btn_group = ttk.Labelframe(master=container, text="Buttons", padding=(10, 5)) btn_group.pack(fill=X) menu = ttk.Menu(self) for i, t in enumerate(self.style.theme_names()): menu.add_radiobutton(label=t, value=i) default = ttk.Button(master=btn_group, text="solid button") default.pack(fill=X, pady=5) default.focus_set() mb = ttk.Menubutton( master=btn_group, text="solid menubutton", bootstyle=SECONDARY, menu=menu, ) mb.pack(fill=X, pady=5) cb = ttk.Checkbutton( master=btn_group, text="solid toolbutton", bootstyle=(SUCCESS, TOOLBUTTON), ) cb.invoke() cb.pack(fill=X, pady=5) ob = ttk.Button(master=btn_group, text="outline button", bootstyle=(INFO, OUTLINE)) ob.pack(fill=X, pady=5) mb = ttk.Menubutton( master=btn_group, text="outline menubutton", bootstyle=(WARNING, OUTLINE), menu=menu, ) mb.pack(fill=X, pady=5) cb = ttk.Checkbutton( master=btn_group, text="outline toolbutton", bootstyle="success-outline-toolbutton", ) cb.pack(fill=X, pady=5) lb = ttk.Button(master=btn_group, text="link button", bootstyle=LINK) lb.pack(fill=X, pady=5) cb1 = ttk.Checkbutton( master=btn_group, text="rounded toggle", bootstyle=(SUCCESS, ROUND, TOGGLE), ) cb1.invoke() cb1.pack(fill=X, pady=5) cb2 = ttk.Checkbutton(master=btn_group, text="squared toggle", bootstyle=(SQUARE, TOGGLE)) cb2.pack(fill=X, pady=5) cb2.invoke() input_group = ttk.Labelframe(master=container, text="Other input widgets", padding=10) input_group.pack(fill=BOTH, pady=(10, 5), expand=YES) entry = ttk.Entry(input_group) entry.pack(fill=X) entry.insert(END, "entry widget") password = ttk.Entry(master=input_group, show="•") password.pack(fill=X, pady=5) password.insert(END, "password") spinbox = ttk.Spinbox(master=input_group, from_=0, to=100) spinbox.pack(fill=X) spinbox.set(45) cbo = ttk.Combobox( master=input_group, text=self.style.theme.name, values=self.style.theme_names(), ) cbo.pack(fill=X, pady=5) cbo.current(self.style.theme_names().index(self.style.theme.name)) de = ttk.DateEntry(input_group) de.pack(fill=X)
root = tk.Tk() style = ttk.Style() frame = ttk.Frame(padding=5) frame.pack(padx=5, pady=5, fill=tk.X) frame1 = ttk.Frame(frame) frame2 = ttk.Frame(frame) frame3 = ttk.Frame(frame) frame1.pack(fill=tk.X) frame2.pack(fill=tk.X) frame3.pack(fill=tk.X) for i, color in enumerate(['default', *style.colors]): if i < 5: a = ttk.Entry(frame1, bootstyle=color, width=12) else: a = ttk.Entry(frame2, bootstyle=color, width=12) a.insert('end', color) a.pack(side=tk.LEFT, padx=3, pady=10) # disabled a = ttk.Entry(frame3, width=12) a.insert(tk.END, 'disabled') a.pack(side=tk.LEFT, padx=3, pady=10) a.configure(state=tk.DISABLED) # readonly a = ttk.Entry(frame3, width=12) a.insert(tk.END, 'readonly') a.pack(side=tk.LEFT, padx=3, pady=10)
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, isServer: bool = False): style = ttk.Style("cosmo") self._root = style.master self._root.title("FBRecorder") self._root.resizable(False, False) self._root.protocol("WM_DELETE_WINDOW", self.shutdown) self._recv = FBFloatMultiRecv() self._recv.registerRecvAllCallback(self.updateData) self._client = FBServer() if isServer else FBClient() self._client.registerRecvCallback(self._recv.input) self._csvWriter: FBCSVWriter = None self._cvsWriterLock = threading.Lock() self.cnt = 0 self._cntLock = threading.Lock() self._cntVar = tk.StringVar(value="0") cfgFrame = ttk.Frame(self._root) cfgFrame.pack(padx=5, pady=5) self.cfg_path = tk.StringVar() self._cfgPathEntry = ttk.Entry(cfgFrame, textvariable=self.cfg_path, state="readonly", width=30) self._cfgPathButton = ttk.Button(cfgFrame, text="选择", command=self._selectCfgPath) ttk.Label(cfgFrame, text="配置文件").pack(side="left") self._cfgPathEntry.pack(side="left") self._cfgPathButton.pack(side="left") saveFrame = ttk.Frame(self._root) saveFrame.pack(padx=5, pady=5) self.save_path = tk.StringVar() self._savePathEntry = ttk.Entry(saveFrame, textvariable=self.save_path, state="readonly", width=30) self._savePathButton = ttk.Button(saveFrame, text="选择", command=self._selectSavePath) ttk.Label(saveFrame, text="保存文件").pack(side="left") self._savePathEntry.pack(side="left") self._savePathButton.pack(side="left") opFrame = ttk.Frame(self._root) opFrame.pack(padx=5, pady=5, fill="x", expand=True) self._appendsButton = ttk.Checkbutton( opFrame, text="追加", bootstyle=("info", "outline", "toolbutton"), ) self._recordButton = ttk.Checkbutton(opFrame, text="录制", command=self._toggleRecord, bootstyle=("warning", "outline", "toolbutton")) self._pauseButton = ttk.Checkbutton(opFrame, text="暂停", bootstyle=("success", "outline", "toolbutton")) self._appendsButton.pack(side="left") self._recordButton.pack(side="left", padx=5) self._pauseButton.pack(side="left") ttk.Label(opFrame, text="已接收:").pack(side="left") ttk.Label(opFrame, textvariable=self._cntVar).pack(side="left")
The widget on which to add validation. when (str): Specifies when to apply validation. See the `add_validation` method docstring for a full list of options. """ add_validation(widget, _validate_options, options=options, when=when) if __name__ == "__main__": app = ttk.Window() @validator def myvalidation(event: ValidationEvent) -> bool: print(event.postchangetext) return True entry = ttk.Entry() entry.pack(padx=10, pady=10) entry2 = ttk.Entry() entry2.pack(padx=10, pady=10) # add_validation(entry, validate_range, startrange=5, endrange=10) # add_validation(entry, validate_regex, pattern="israel") add_text_validation(entry, when="key") # prevents from using any numbers add_text_validation(entry2, when="key") # add_option_validation(entry, ['red', 'blue', 'green'], 'focusout') # add_regex_validation(entry, r'\d{4}-\d{2}-\d{2}') ttk.Button(text="Other").pack(padx=10, pady=10) app.mainloop()
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.pack(fill=BOTH, expand=YES) image_files = { 'properties-dark': 'icons8_settings_24px.png', 'properties-light': 'icons8_settings_24px_2.png', 'add-to-backup-dark': 'icons8_add_folder_24px.png', 'add-to-backup-light': 'icons8_add_book_24px.png', 'stop-backup-dark': 'icons8_cancel_24px.png', 'stop-backup-light': 'icons8_cancel_24px_1.png', 'play': 'icons8_play_24px_1.png', 'refresh': 'icons8_refresh_24px_1.png', 'stop-dark': 'icons8_stop_24px.png', 'stop-light': 'icons8_stop_24px_1.png', 'opened-folder': 'icons8_opened_folder_24px.png', 'logo': 'backup.png' } self.photoimages = [] imgpath = Path(__file__).parent / 'assets' for key, val in image_files.items(): _path = imgpath / val self.photoimages.append(ttk.PhotoImage(name=key, file=_path)) # buttonbar buttonbar = ttk.Frame(self, style='primary.TFrame') buttonbar.pack(fill=X, pady=1, side=TOP) ## new backup _func = lambda: Messagebox.ok(message='Adding new backup') btn = ttk.Button(master=buttonbar, text='New backup set', image='add-to-backup-light', compound=LEFT, command=_func) btn.pack(side=LEFT, ipadx=5, ipady=5, padx=(1, 0), pady=1) ## backup _func = lambda: Messagebox.ok(message='Backing up...') btn = ttk.Button(master=buttonbar, text='Backup', image='play', compound=LEFT, command=_func) btn.pack(side=LEFT, ipadx=5, ipady=5, padx=0, pady=1) ## refresh _func = lambda: Messagebox.ok(message='Refreshing...') btn = ttk.Button(master=buttonbar, text='Refresh', image='refresh', compound=LEFT, command=_func) btn.pack(side=LEFT, ipadx=5, ipady=5, padx=0, pady=1) ## stop _func = lambda: Messagebox.ok(message='Stopping backup.') btn = ttk.Button(master=buttonbar, text='Stop', image='stop-light', compound=LEFT, command=_func) btn.pack(side=LEFT, ipadx=5, ipady=5, padx=0, pady=1) ## settings _func = lambda: Messagebox.ok(message='Changing settings') btn = ttk.Button(master=buttonbar, text='Settings', image='properties-light', compound=LEFT, command=_func) btn.pack(side=LEFT, ipadx=5, ipady=5, padx=0, pady=1) # left panel left_panel = ttk.Frame(self, style='bg.TFrame') left_panel.pack(side=LEFT, fill=Y) ## backup summary (collapsible) bus_cf = CollapsingFrame(left_panel) bus_cf.pack(fill=X, pady=1) ## container bus_frm = ttk.Frame(bus_cf, padding=5) bus_frm.columnconfigure(1, weight=1) bus_cf.add(child=bus_frm, title='Backup Summary', bootstyle=SECONDARY) ## destination lbl = ttk.Label(bus_frm, text='Destination:') lbl.grid(row=0, column=0, sticky=W, pady=2) lbl = ttk.Label(bus_frm, textvariable='destination') lbl.grid(row=0, column=1, sticky=EW, padx=5, pady=2) self.setvar('destination', 'd:/test/') ## last run lbl = ttk.Label(bus_frm, text='Last Run:') lbl.grid(row=1, column=0, sticky=W, pady=2) lbl = ttk.Label(bus_frm, textvariable='lastrun') lbl.grid(row=1, column=1, sticky=EW, padx=5, pady=2) self.setvar('lastrun', '14.06.2021 19:34:43') ## files Identical lbl = ttk.Label(bus_frm, text='Files Identical:') lbl.grid(row=2, column=0, sticky=W, pady=2) lbl = ttk.Label(bus_frm, textvariable='filesidentical') lbl.grid(row=2, column=1, sticky=EW, padx=5, pady=2) self.setvar('filesidentical', '15%') ## section separator sep = ttk.Separator(bus_frm, bootstyle=SECONDARY) sep.grid(row=3, column=0, columnspan=2, pady=10, sticky=EW) ## properties button _func = lambda: Messagebox.ok(message='Changing properties') bus_prop_btn = ttk.Button(master=bus_frm, text='Properties', image='properties-dark', compound=LEFT, command=_func, bootstyle=LINK) bus_prop_btn.grid(row=4, column=0, columnspan=2, sticky=W) ## add to backup button _func = lambda: Messagebox.ok(message='Adding to backup') add_btn = ttk.Button(master=bus_frm, text='Add to backup', image='add-to-backup-dark', compound=LEFT, command=_func, bootstyle=LINK) add_btn.grid(row=5, column=0, columnspan=2, sticky=W) # backup status (collapsible) status_cf = CollapsingFrame(left_panel) status_cf.pack(fill=BOTH, pady=1) ## container status_frm = ttk.Frame(status_cf, padding=10) status_frm.columnconfigure(1, weight=1) status_cf.add(child=status_frm, title='Backup Status', bootstyle=SECONDARY) ## progress message lbl = ttk.Label(master=status_frm, textvariable='prog-message', font='Helvetica 10 bold') lbl.grid(row=0, column=0, columnspan=2, sticky=W) self.setvar('prog-message', 'Backing up...') ## progress bar pb = ttk.Progressbar(master=status_frm, variable='prog-value', bootstyle=SUCCESS) pb.grid(row=1, column=0, columnspan=2, sticky=EW, pady=(10, 5)) self.setvar('prog-value', 71) ## time started lbl = ttk.Label(status_frm, textvariable='prog-time-started') lbl.grid(row=2, column=0, columnspan=2, sticky=EW, pady=2) self.setvar('prog-time-started', 'Started at: 14.06.2021 19:34:56') ## time elapsed lbl = ttk.Label(status_frm, textvariable='prog-time-elapsed') lbl.grid(row=3, column=0, columnspan=2, sticky=EW, pady=2) self.setvar('prog-time-elapsed', 'Elapsed: 1 sec') ## time remaining lbl = ttk.Label(status_frm, textvariable='prog-time-left') lbl.grid(row=4, column=0, columnspan=2, sticky=EW, pady=2) self.setvar('prog-time-left', 'Left: 0 sec') ## section separator sep = ttk.Separator(status_frm, bootstyle=SECONDARY) sep.grid(row=5, column=0, columnspan=2, pady=10, sticky=EW) ## stop button _func = lambda: Messagebox.ok(message='Stopping backup') btn = ttk.Button(master=status_frm, text='Stop', image='stop-backup-dark', compound=LEFT, command=_func, bootstyle=LINK) btn.grid(row=6, column=0, columnspan=2, sticky=W) ## section separator sep = ttk.Separator(status_frm, bootstyle=SECONDARY) sep.grid(row=7, column=0, columnspan=2, pady=10, sticky=EW) # current file message lbl = ttk.Label(status_frm, textvariable='current-file-msg') lbl.grid(row=8, column=0, columnspan=2, pady=2, sticky=EW) self.setvar('current-file-msg', 'Uploading: d:/test/settings.txt') # logo lbl = ttk.Label(left_panel, image='logo', style='bg.TLabel') lbl.pack(side='bottom') # right panel right_panel = ttk.Frame(self, padding=(2, 1)) right_panel.pack(side=RIGHT, fill=BOTH, expand=YES) ## file input browse_frm = ttk.Frame(right_panel) browse_frm.pack(side=TOP, fill=X, padx=2, pady=1) file_entry = ttk.Entry(browse_frm, textvariable='folder-path') file_entry.pack(side=LEFT, fill=X, expand=YES) btn = ttk.Button(master=browse_frm, image='opened-folder', bootstyle=(LINK, SECONDARY), command=self.get_directory) btn.pack(side=RIGHT) ## Treeview tv = ttk.Treeview(right_panel, show='headings', height=5) tv.configure(columns=('name', 'state', 'last-modified', 'last-run-time', 'size')) tv.column('name', width=150, stretch=True) for col in ['last-modified', 'last-run-time', 'size']: tv.column(col, stretch=False) for col in tv['columns']: tv.heading(col, text=col.title(), anchor=W) tv.pack(fill=X, pady=1) ## scrolling text output scroll_cf = CollapsingFrame(right_panel) scroll_cf.pack(fill=BOTH, expand=YES) output_container = ttk.Frame(scroll_cf, padding=1) _value = 'Log: Backing up... [Uploading file: D:/sample_file_35.txt]' self.setvar('scroll-message', _value) st = ScrolledText(output_container) st.pack(fill=BOTH, expand=YES) scroll_cf.add(output_container, textvariable='scroll-message') # seed with some sample data ## starting sample directory file_entry.insert(END, 'D:/text/myfiles/top-secret/samples/') ## treeview and backup logs for x in range(20, 35): result = choices(['Backup Up', 'Missed in Destination'])[0] st.insert(END, f'19:34:{x}\t\t Uploading: D:/file_{x}.txt\n') st.insert(END, f'19:34:{x}\t\t Upload {result}.\n') timestamp = datetime.now().strftime('%d.%m.%Y %H:%M:%S') tv.insert('', END, x, values=(f'sample_file_{x}.txt', result, timestamp, timestamp, f'{int(x // 3)} MB')) tv.selection_set(20)