tSs
tSs

Reputation: 125

Is there a way to set tabs of a Notebook below one another?

So far when using the ttk.Notebook widget, but I am unable to set tabs below one another, they keep piling up eastward.

Is there a way to set them to stack somehow?

Upvotes: 6

Views: 4444

Answers (2)

taga
taga

Reputation: 3885

Yes, please check this code:

import tkinter as tk
from tkinter import ttk

root = tk.Tk()

style = ttk.Style(root)
style.configure('lefttab.TNotebook', tabposition='wn')

notebook = ttk.Notebook(root, style='lefttab.TNotebook')

f1 = tk.Frame(notebook, bg='red', width=200, height=200)
f2 = tk.Frame(notebook, bg='blue', width=200, height=200)

notebook.add(f1, text='Frame 1')
notebook.add(f2, text='Frame 2')

notebook.grid(row=0, column=0, sticky="nw")

root.mainloop()

Upvotes: 7

Smurf-IV
Smurf-IV

Reputation: 91

For reference - Yes

See the code in the following top right tabs

And use 'wn' to force the tabs to stack in the top left and downwards

Upvotes: 0

Related Questions