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
bot_frame = ttk.Frame(frame) top_frame.pack(fill=tk.X) bot_frame.pack(fill=tk.X) # for i, color in enumerate(['default', *style.colors]): # if i < 5: # f = ttk.Frame(top_frame) # else: # f = ttk.Frame(bot_frame) # ttk.Label(f, text=color, width=20).pack(side=tk.TOP) # a = ttk.Scrollbar(f, bootstyle=color, orient=tk.HORIZONTAL) # a.set(0, 1.0) # a.pack(fill=tk.X) # f.pack(side=tk.LEFT, padx=3, pady=10, fill=tk.X) for i, color in enumerate(['default', *style.colors]): if i < 5: f = ttk.Frame(top_frame) else: f = ttk.Frame(bot_frame) ttk.Label(f, text=color, width=20).pack(side=tk.TOP) a = ttk.Scrollbar(f, bootstyle=color + 'round', orient=tk.HORIZONTAL) a.set(0, 1.0) a.pack(fill=tk.X) f.pack(side=tk.LEFT, padx=3, pady=10, fill=tk.X) root.mainloop()
c1 = tk.Checkbutton(rcframe, text="Check One") c1.invoke() c1.pack(side=LEFT) c2 = tk.Checkbutton(rcframe, text="Check two") c2.pack(side=LEFT) # scale widget app.setvar("scale", 25) scaleframe = tk.Frame(lf, pady=5) scaleframe.pack(fill=X, expand=YES) scale = tk.Scale(scaleframe, orient=HORIZONTAL, variable="scale") scale.pack(side=LEFT, fill=X, expand=YES, pady=5) tk.Label(scaleframe, textvariable="scale").pack(side=RIGHT, padx=(5, 0)) # text list frame textframe = tk.Frame(lf, pady=10) textframe.pack(fill=X, expand=YES) txt = tk.Text(textframe, width=30, height=8) txt.pack(side=LEFT, fill=X) txt.insert(END, ZEN) lb = tk.Listbox(textframe, height=8) lb.pack(side=LEFT, fill=X, padx=(5, 0)) [lb.insert(END, c) for c in app.style.colors] # scrollbar sb = ttk.Scrollbar(lf, orient=HORIZONTAL) sb.pack(fill=X, expand=YES) sb.set(0.05, 0.95) app.mainloop()
def create_left_frame(self): """Create all the left frame widgets""" container = ttk.Frame(self) container.pack(side=LEFT, fill=BOTH, expand=YES, padx=5) # demonstrates all color options inside a label color_group = ttk.Labelframe(master=container, text="Theme color options", padding=10) color_group.pack(fill=X, side=TOP) for color in self.style.colors: cb = ttk.Button(color_group, text=color, bootstyle=color) cb.pack(side=LEFT, expand=YES, padx=5, fill=X) # demonstrates all radiobutton widgets active and disabled cr_group = ttk.Labelframe(master=container, text="Checkbuttons & radiobuttons", padding=10) cr_group.pack(fill=X, pady=10, side=TOP) cr1 = ttk.Checkbutton(cr_group, text="selected") cr1.pack(side=LEFT, expand=YES, padx=5) cr1.invoke() cr2 = ttk.Checkbutton(cr_group, text="deselected") cr2.pack(side=LEFT, expand=YES, padx=5) cr3 = ttk.Checkbutton(cr_group, text="disabled", state=DISABLED) cr3.pack(side=LEFT, expand=YES, padx=5) cr4 = ttk.Radiobutton(cr_group, text="selected", value=1) cr4.pack(side=LEFT, expand=YES, padx=5) cr4.invoke() cr5 = ttk.Radiobutton(cr_group, text="deselected", value=2) cr5.pack(side=LEFT, expand=YES, padx=5) cr6 = ttk.Radiobutton(cr_group, text="disabled", value=3, state=DISABLED) cr6.pack(side=LEFT, expand=YES, padx=5) # demonstrates the treeview and notebook widgets ttframe = ttk.Frame(container) 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) 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 = ttk.Text(master=container, height=5, width=50, wrap="none") txt.insert(END, DemoWidgets.ZEN) txt.pack(side=LEFT, anchor=NW, pady=5, fill=BOTH, expand=YES) # demonstrates scale, progressbar, and meter, and scrollbar widgets lframe_inner = ttk.Frame(container) lframe_inner.pack(fill=BOTH, expand=YES, padx=10) scale = ttk.Scale(master=lframe_inner, orient=HORIZONTAL, value=75, from_=100, to=0) scale.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)
def __init__(self, master: "FBWidgetCanvas"): super().__init__(master) self.protocol("WM_DELETE_WINDOW", master.destroyCmdTable) self.tableFrame = ttk.Frame(self) self.tableFrame.pack(fill="both", expand=True) self.buttonFrame = ttk.Frame(self) self.buttonFrame.pack(fill="x", ipadx=5, ipady=5) self.tree = ttk.Treeview( self.tableFrame, columns=["name", "command", "variable", "binding"], show="headings") self.scrollbar = ttk.Scrollbar(self.tableFrame, orient="vertical", command=self.tree.yview) self.tree.configure(yscrollcommand=self.scrollbar.set) self.scrollbar.pack(side="right", fill="y") self.tree.pack(side="right", fill="both", expand=True) self.tree.heading("name", text="名称", anchor="w") self.tree.heading("command", text="指令", anchor="e") self.tree.heading("variable", text="变量", anchor="e") self.tree.heading("binding", text="绑定", anchor="e") self.tree.column("name", width=80, anchor="w") self.tree.column("command", width=200, anchor="e") self.tree.column("variable", width=200, anchor="e") self.tree.column("binding", width=200, anchor="e") self.tree.bind("<<TreeviewSelect>>", self._onSelect) self.tree.bind("<Double-1>", self._onDoubleClick) self.btn_close = ttk.Button(self.buttonFrame, text="关闭", command=master.destroyCmdTable) self.btn_add = ttk.Button(self.buttonFrame, text="添加", command=self._add) self.btn_dup = ttk.Button(self.buttonFrame, text="复制", command=self._dup) self.btn_del = ttk.Button(self.buttonFrame, text="删除", command=self._delete) self.btn_edit = ttk.Button(self.buttonFrame, text="编辑", command=self._edit) self.btn_up = ttk.Button(self.buttonFrame, text="上移", command=self._up) self.btn_down = ttk.Button(self.buttonFrame, text="下移", command=self._down) for btn in ( self.btn_close, self.btn_add, self.btn_dup, self.btn_del, self.btn_edit, self.btn_up, self.btn_down, ): btn.pack(side="left", expand=True) self._state = "!disabled" self._checkSel() self.cmdDict = master.cmdDict for v in master.cmdList: self.tree.insert("", "end", values=v)
def __init__( self, master=None, padding=2, bootstyle=DEFAULT, autohide=False, vbar=True, hbar=False, **kwargs, ): """ Parameters: master (Widget): The parent widget. padding (int): The amount of empty space to create on the outside of the widget. bootstyle (str): A style keyword used to set the color and style of the vertical scrollbar. Available options include -> primary, secondary, success, info, warning, danger, dark, light. vbar (bool): A vertical scrollbar is shown when **True** (default). hbar (bool): A horizontal scrollbar is shown when **True**. Turning on this scrollbar will also set `wrap="none"`. This scrollbar is _off_ by default. autohide (bool): When **True**, the scrollbars will hide when the mouse is not within the frame bbox. **kwargs (Dict[str, Any]): Other keyword arguments passed to the `Text` widget. """ super().__init__(master, padding=padding) # setup text widget self._text = ttk.Text(self, padx=50, **kwargs) self._hbar = None self._vbar = None # delegate text methods to frame for method in vars(ttk.Text).keys(): if any(["pack" in method, "grid" in method, "place" in method]): pass else: setattr(self, method, getattr(self._text, method)) # setup scrollbars if vbar: self._vbar = ttk.Scrollbar( master=self, bootstyle=bootstyle, command=self._text.yview, orient=VERTICAL, ) self._vbar.place(relx=1.0, relheight=1.0, anchor=NE) self._text.configure(yscrollcommand=self._vbar.set) if hbar: self._hbar = ttk.Scrollbar( master=self, bootstyle=bootstyle, command=self._text.xview, orient=HORIZONTAL, ) self._hbar.place(rely=1.0, relwidth=1.0, anchor=SW) self._text.configure(xscrollcommand=self._hbar.set, wrap="none") self._text.pack(side=LEFT, fill=BOTH, expand=YES) # position scrollbars if self._hbar: self.update_idletasks() self._text_width = self.winfo_reqwidth() self._scroll_width = self.winfo_reqwidth() self.bind("<Configure>", self._on_configure) if autohide: self.autohide_scrollbar() self.hide_scrollbars()
def __init__( self, master=None, padding=2, bootstyle=DEFAULT, autohide=False, height=200, width=300, scrollheight=None, **kwargs, ): """ Parameters: master (Widget): The parent widget. padding (int): The amount of empty space to create on the outside of the widget. bootstyle (str): A style keyword used to set the color and style of the vertical scrollbar. Available options include -> primary, secondary, success, info, warning, danger, dark, light. autohide (bool): When **True**, the scrollbars will hide when the mouse is not within the frame bbox. height (int): The height of the container frame in screen units. width (int): The width of the container frame in screen units. scrollheight (int): The height of the content frame in screen units. If None, the height is determined by the frame contents. **kwargs (Dict[str, Any]): Other keyword arguments passed to the content frame. """ # content frame container self.container = ttk.Frame( master=master, relief=FLAT, borderwidth=0, width=width, height=height, ) self.container.bind("<Configure>", lambda _: self.yview()) self.container.propagate(0) # content frame super().__init__( master=self.container, padding=padding, bootstyle=bootstyle.replace('round', ''), width=width, height=height, **kwargs, ) self.place(rely=0.0, relwidth=1.0, height=scrollheight) # vertical scrollbar self.vscroll = ttk.Scrollbar( master=self.container, command=self.yview, orient=VERTICAL, bootstyle=bootstyle, ) self.vscroll.pack(side=RIGHT, fill=Y) self.winsys = self.tk.call("tk", "windowingsystem") # setup autohide scrollbar self.autohide = autohide if self.autohide: self.hide_scrollbars() # widget event binding self.container.bind("<Enter>", self._on_enter, "+") self.container.bind("<Leave>", self._on_leave, "+") self.container.bind("<Map>", self._on_map, "+") self.bind("<<MapChild>>", self._on_map_child, "+") # delegate content geometry methods to container frame _methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys() for method in _methods: if any(["pack" in method, "grid" in method, "place" in method]): # prefix content frame methods with 'content_' setattr(self, f"content_{method}", getattr(self, method)) # overwrite content frame methods from container frame setattr(self, method, getattr(self.container, method))
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)