问题
I am using a tkinter.ttk.Notebook
and the tabs seem to get thinner with time. How do I overcome this? Is there a possibility to specify a uniform width for each tab?
I use this code to add a tab:
notebook.add(game.frame, text=game.name, underline=0, sticky=tkinter.NS)
回答1:
I don't know if it's possible to set a uniform width for each tab, but it seems that the tab width problem is style dependent:
- with style "alt" the tab name SEVEN is partially hidden:
- with style "clam" it is fully visible:
Here is how to change style of the whole window:
sty = ttk.Style()
sty.theme_use(theme_name)
To get the list of all theme names: sty.theme_names()
.
You can get more information on ttk styles here http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/ttk-theme-layer.html.
来源:https://stackoverflow.com/questions/38243547/why-do-the-tkinter-ttk-notebook-tabs-get-thinner-and-thinner