6

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?

nbro
  • 15,395
  • 32
  • 113
  • 196
tSs
  • 125
  • 3
  • 9

2 Answers2

7

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()
taga
  • 3,537
  • 13
  • 53
  • 119
  • While this code may answer the question, which might provide some limited, immediate help. A [proper explanation](https://meta.stackexchange.com/q/114762) would greatly improve its long-term value by showing why this is a good solution to the problem and would make it more useful to future readers with other, similar questions. Please [edit](https://meta.stackoverflow.com/posts/360251/edit) your answer to add some explanation, including the assumptions you’ve made. – martineau Dec 04 '21 at 22:03
0

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

Smurf-IV
  • 91
  • 1
  • 3
  • 1
    Please try to include the actual code sample in the answer as well as the link. I know the link is to a SO page but it is easier if the code is within the answer. – OldBoyCoder Jun 09 '16 at 12:41