Request Help With ttk.Notebook Tabs
Wildman
best_lay at yahoo.com
Tue Feb 21 13:36:42 EST 2017
On Tue, 21 Feb 2017 18:22:31 +0000, MRAB wrote:
> On 2017-02-21 18:02, Wildman via Python-list 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.
>>
> If you want other widgets above the Notebook widget, why don't you just
> put them there in a frame?
Thanks for the reply. That approach would work but I found
a simple method that serves the purpose using padx/pady. I
was doing my research in the areas of grid and place. Didn't
think about pack.
--
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!
More information about the Python-list
mailing list