Python tkinter.ttk.Labelframe() Examples

The following are 7 code examples of tkinter.ttk.Labelframe(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter.ttk , or try the search function .
Example #1
Source File: Preferences.py    From python-in-practice with GNU General Public License v3.0 6 votes vote down vote up
def create_widgets(self, master):
        self.frame = ttk.Frame(master)
        self.restoreFrame = ttk.Labelframe(self.frame, text="Restore")
        self.restoreWindowCheckbutton = TkUtil.Checkbutton(
                self.restoreFrame, text="Window Position and Size",
                underline=0, variable=self.restoreWindow)
        TkUtil.Tooltip.Tooltip(self.restoreWindowCheckbutton,
                "Restore Toolbars and Window Position and Size at Startup")
        self.restoreFontCheckbutton = TkUtil.Checkbutton(self.restoreFrame,
                text="Font Settings", underline=0,
                variable=self.restoreFont)
        TkUtil.Tooltip.Tooltip(self.restoreFontCheckbutton,
                "Restore the Last Used Font Settings at Startup")
        self.restoreSessionCheckbutton = TkUtil.Checkbutton(
                self.restoreFrame, text="Session", underline=0,
                variable=self.restoreSession)
        TkUtil.Tooltip.Tooltip(self.restoreSessionCheckbutton,
                "Open the Last Edited File at Startup")
        self.otherFrame = ttk.Labelframe(self.frame, text="Other")
        self.blinkCheckbutton = TkUtil.Checkbutton(self.otherFrame,
                text="Blinking Cursor", underline=0, variable=self.blink)
        TkUtil.Tooltip.Tooltip(self.blinkCheckbutton,
                "Switch Cursor Blink On or Off") 
Example #2
Source File: Preferences.py    From python-in-practice with GNU General Public License v3.0 6 votes vote down vote up
def create_widgets(self, master):
        self.frame = ttk.Frame(master)
        self.restoreFrame = ttk.Labelframe(self.frame, text="Restore")
        self.restoreWindowCheckbutton = TkUtil.Checkbutton(
                self.restoreFrame, text="Window Position and Size",
                underline=0, variable=self.restoreWindow)
        TkUtil.Tooltip.Tooltip(self.restoreWindowCheckbutton,
                "Restore Toolbars and Window Position and Size at Startup")
        self.restoreFontCheckbutton = TkUtil.Checkbutton(self.restoreFrame,
                text="Font Settings", underline=0,
                variable=self.restoreFont)
        TkUtil.Tooltip.Tooltip(self.restoreFontCheckbutton,
                "Restore the Last Used Font Settings at Startup")
        self.restoreSessionCheckbutton = TkUtil.Checkbutton(
                self.restoreFrame, text="Session", underline=0,
                variable=self.restoreSession)
        TkUtil.Tooltip.Tooltip(self.restoreSessionCheckbutton,
                "Open the Last Edited File at Startup")
        self.otherFrame = ttk.Labelframe(self.frame, text="Other")
        self.blinkCheckbutton = TkUtil.Checkbutton(self.otherFrame,
                text="Blinking Cursor", underline=0, variable=self.blink)
        TkUtil.Tooltip.Tooltip(self.blinkCheckbutton,
                "Switch Cursor Blink On or Off") 
Example #3
Source File: fc_clean.py    From fastclass with Apache License 2.0 5 votes vote down vote up
def setup(self):
        self.Canvas = tk.Label(self)
        self.Canvas.grid(row=0, column=0, columnspan=6, rowspan=6)
        ttk.Button(self, text="Prev", command=self.display_prev).grid(row=4, column=6)
        ttk.Button(self, text="Next", command=self.display_next).grid(row=4, column=7)
        ttk.Button(self, text="Save & Exit", command=self.save_and_exit).grid(
            row=5, column=6, columnspan=2
        )

        self.lfdata = ttk.Labelframe(self, padding=(2, 2, 4, 4), text="Selection")
        self.lfdata.grid(row=0, column=6, columnspan=2, sticky="ne")
        for i, item in enumerate(digits + "d"):
            ttk.Button(
                self.lfdata, text=item, command=partial(self.button_callback, item)
            ).grid(in_=self.lfdata, column=6 + i % 2, row=i // 2, sticky="w") 
Example #4
Source File: extended_pyGISS.py    From pyGISS with MIT License 5 votes vote down vote up
def __init__(self, path_app):
        super().__init__()
        self.title('Extended PyGISS')
        path_icon = abspath(join(path_app, pardir, 'images'))
        
        # generate the PSF tk images
        img_psf = ImageTk.Image.open(join(path_icon, 'node.png'))
        selected_img_psf = ImageTk.Image.open(join(path_icon, 'selected_node.png'))
        self.psf_button_image = ImageTk.PhotoImage(img_psf.resize((100, 100)))
        self.node_image = ImageTk.PhotoImage(img_psf.resize((40, 40)))
        self.selected_node_image = ImageTk.PhotoImage(selected_img_psf.resize((40, 40)))

        for widget in (
                       'Button',
                       'Label', 
                       'Labelframe', 
                       'Labelframe.Label', 
                       ):
            ttk.Style().configure('T' + widget, background='#A1DBCD')

        self.map = Map(self)
        self.map.pack(side='right', fill='both', expand=1)

        self.menu = Menu(self)
        self.menu.pack(side='right', fill='both', expand=1)

        menu = tk.Menu(self)
        menu.add_command(label="Import shapefile", command=self.map.import_map)
        self.config(menu=menu)

        # if motion is called, the left-click button was released and we 
        # can stop the drag and drop process
        self.bind_all('<Motion>', self.stop_drag_and_drop)
        self.drag_and_drop = False

        self.image = None
        self.bind_all('<B1-Motion>', lambda _:_) 
Example #5
Source File: main.py    From tkinter-logging-text-widget with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def __init__(self, root):
        self.root = root
        root.title('Logging Handler')
        root.columnconfigure(0, weight=1)
        root.rowconfigure(0, weight=1)
        # Create the panes and frames
        vertical_pane = ttk.PanedWindow(self.root, orient=VERTICAL)
        vertical_pane.grid(row=0, column=0, sticky="nsew")
        horizontal_pane = ttk.PanedWindow(vertical_pane, orient=HORIZONTAL)
        vertical_pane.add(horizontal_pane)
        form_frame = ttk.Labelframe(horizontal_pane, text="MyForm")
        form_frame.columnconfigure(1, weight=1)
        horizontal_pane.add(form_frame, weight=1)
        console_frame = ttk.Labelframe(horizontal_pane, text="Console")
        console_frame.columnconfigure(0, weight=1)
        console_frame.rowconfigure(0, weight=1)
        horizontal_pane.add(console_frame, weight=1)
        third_frame = ttk.Labelframe(vertical_pane, text="Third Frame")
        vertical_pane.add(third_frame, weight=1)
        # Initialize all frames
        self.form = FormUi(form_frame)
        self.console = ConsoleUi(console_frame)
        self.third = ThirdUi(third_frame)
        self.clock = Clock()
        self.clock.start()
        self.root.protocol('WM_DELETE_WINDOW', self.quit)
        self.root.bind('<Control-q>', self.quit)
        signal.signal(signal.SIGINT, self.quit) 
Example #6
Source File: sqlite_bro.py    From sqlite_bro with MIT License 4 votes vote down vote up
def __init__(self):
        """create a tkk graphic interface with a main window tk_win"""
        self.__version__ = '0.9.1'
        self._title = "2019-06-16a : 'Support un-named Tabs!'"
        self.conn = None  # Baresql database object
        self.database_file = ""
        self.tk_win = Tk()
        self.tk_win.title('A graphic SQLite Client in 1 Python file')
        self.tk_win.option_add('*tearOff', FALSE)   # hint of tk documentation
        self.tk_win.minsize(600, 200)               # minimal size

        self.font_size = 10
        self.font_wheight = 0
        self.initialdir = "."
        # With a Menubar and Toolbar
        self.create_menu()
        self.create_toolbar()

        # Create style "ButtonNotebook"
        self.create_style()
        # Initiate Drag State
        self.state_drag = False
        self.state_drag_index = 0

        # With a Panedwindow of two frames: 'Database' and 'Queries'
        p = ttk.Panedwindow(self.tk_win, orient=HORIZONTAL)
        p.pack(fill=BOTH, expand=1)

        f_database = ttk.Labelframe(p, text='Databases', width=200, height=100)
        p.add(f_database)
        f_queries = ttk.Labelframe(p, text='Queries', width=200, height=100)
        p.add(f_queries)

        # build tree view 't' inside the left 'Database' Frame
        self.db_tree = ttk.Treeview(f_database, displaycolumns=[],
                                    columns=("detail", "action"))
        self.db_tree.tag_configure("run")
        self.db_tree.pack(fill=BOTH, expand=1)

        # create a  notebook 'n' inside the right 'Queries' Frame
        self.n = NotebookForQueries(self.tk_win, f_queries, [])

        # Bind keyboard shortcuts
        self.tk_win.bind('<F9>', self.run_tab) 
Example #7
Source File: sqlite_bro.py    From sqlite_bro with MIT License 4 votes vote down vote up
def new_query_tab(self, title, query):
        """add a Tab 'title' to the notebook, containing the Script 'query'"""

        fw_welcome = ttk.Panedwindow(self.tk_win, orient=VERTICAL)  # tk_win
        fw_welcome.pack(fill='both', expand=True)
        self.notebook.add(fw_welcome, text=(title))

        # new "editable" script
        f1 = ttk.Labelframe(fw_welcome, text='Script', width=200, height=100)
        fw_welcome.add(f1)
        fw_label = Text(f1, bd=1, undo=True)

        scroll = ttk.Scrollbar(f1, command=fw_label.yview)
        fw_label.configure(yscrollcommand=scroll.set)
        fw_label.insert(END, (query))
        fw_label.pack(side=LEFT, expand=YES, fill=BOTH, padx=2, pady=2)
        scroll.pack(side=RIGHT, expand=NO, fill=BOTH, padx=2, pady=2)

        # keep tab reference  by tk id
        working_tab_id = "." + fw_welcome._name

        # keep tab reference to script (by tk id)
        self.fw_labels[working_tab_id] = fw_label

        # new "Results" Container
        fr = ttk.Labelframe(fw_welcome, text='Results', width=200, height=100)
        fw_welcome.add(fr)

        # containing a notebook
        fw_result_nb = Notebook(fr, style="ButtonNotebook")
        fw_result_nb.pack(fill='both', expand=True)
        # resize rules
        fw_welcome.columnconfigure(0, weight=1)
        # keep reference to result_nb objects (by tk id)
        self.fw_result_nbs[working_tab_id] = fw_result_nb

        # activate this tab print(self.notebook.tabs())
        self.notebook.select(working_tab_id)
        # workaround to have a visible result pane on initial launch
        self.add_treeview(
            working_tab_id, "_", "", "click on ('->') to run Script")
        return working_tab_id  # gives back tk_id reference of the new tab