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

点点圈 提交于 2019-12-23 20:32:49

问题


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?


回答1:


No, there is not a way to do that with the ttk notebook widget.

On a side note: multiple rows of tabs is widely regarded as being very user-UNfriendly from a usability perspective. If you need to create a UI that has that many tabs, you might want to consider a different approach if you're concerned about how easy your program is to use.




回答2:


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()



回答3:


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



来源:https://stackoverflow.com/questions/11387362/is-there-a-way-to-set-tabs-of-a-notebook-below-one-another

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!