Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 256
tSs Avatar asked Jul 08 '12 22:07

tSs


1 Answers

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()
like image 121
taga Avatar answered Nov 07 '22 14:11

taga