[英]Cannot see all tabs in ttk.Notebook
I have some trouble with the tabs from the ttk Notebook class in python 2.7. 我在python 2.7中的ttk Notebook类的选项卡上遇到了一些麻烦。 I cannot see all the tabs I create.
我看不到我创建的所有标签。
I made a minimal code to view the problem: 我做了一个最小的代码来查看问题:
from Tkinter import *
import ttk
root = Tk()
nb = ttk.Notebook(root, width=320, height=240)
nb.pack(fill=BOTH, expand=1)
page0 = Frame(nb)
page1 = Frame(nb)
page2 = Frame(nb)
page3 = Frame(nb)
page4 = Frame(nb)
nb.add(page0, text="0")
nb.add(page1, text="1")
nb.add(page2, text="2")
nb.add(page3, text="3")
nb.add(page4, text="4")
root.mainloop()
All I can see is 我只能看到
I tried to change the number of tabs and I noticed the size of the top tab bar changes and unless there's only one single lonely tab, I cannot see all of them, as you can see: 我试图改变标签的数量,我注意到顶部标签栏的大小发生了变化,除非只有一个孤独的标签,否则我看不到所有标签,你可以看到:
What I tried that didn't do anything: 我尝试过什么都没做:
What I tried that worked but isn't what I want: 我尝试过的有效但不是我想要的:
I'll appreciate any help, thanks! 我会感激任何帮助,谢谢!
So I did fix your issue however, I have no idea why tk is doing this. 所以我确实解决了你的问题,我不知道为什么tk会这样做。 I solved this tab over-lapping by increasing the length of the tab text.
我通过增加选项卡文本的长度来解决此选项卡重叠。 I changed this portion of your code:
我更改了这部分代码:
nb.add(page0, text="long_name1")
nb.add(page1, text="long_name2")
nb.add(page2, text="long_name3")
nb.add(page3, text="long_name4")
nb.add(page4, text="long_name5")
Once again I don't know why tk does this! 再一次,我不知道为什么tk这样做! Someone that is more experienced with tk could probably tell you why.
对tk更有经验的人可能会告诉你原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.