Request Help With ttk.Notebook Tabs

Wildman best_lay at yahoo.com
Tue Feb 21 13:02:50 EST 2017


Python 3.4.2
Linux platform


I am working on a program that has tabs created with ttk.Notebook.
The code for creating the tabs is working but there is one thing I
have not been able to figure out.  As is, the tabs are located up
against the lower edge of the caption bar.  I would like to have
them a little lower to make room above the tabs for other widgets
such as labels and/or command buttons.  Here is the code I use to
create the window and tabs...

class Window(tk.Frame):
    def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        master.title("My Program")
        nb = ttk.Notebook(root, width=600, height=340)
        tab1 = tk.Frame(nb)
        tab2 = tk.Frame(nb)
        nb.add(tab1, text="Tab1")
        nb.add(tab2, text="Tab2")
        nb.pack(expand=1, fill="both")

I have tried the grid and place methods to move the tabs down but
neither works.  I have tried the methods both before and after the
pack method.  Here is an example of what I have tried...

        nb.grid(row=2, column=2)
or
        nb.place(x=10, y=10)

Would be appreciated if anyone could provide any guidance.

-- 
<Wildman> GNU/Linux user #557453
Keyboard not detected! Press any key to continue...



More information about the Python-list mailing list