Request Help With ttk.Notebook Tabs

Wildman best_lay at yahoo.com
Tue Feb 21 13:22:11 EST 2017


On Tue, 21 Feb 2017 12:02:50 -0600, Wildman wrote:

> 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.

I posted too quickly.  I found my answer...

        nb.pack(expand=1, fill="both", padx=20, pady=20)

Sorry.

-- 
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!



More information about the Python-list mailing list