[Tkinter-discuss] ttk.Notebook: autohide
Michael Lange
klappnase at web.de
Wed May 29 17:56:50 EDT 2019
Hi,
On Wed, 29 May 2019 13:01:16 +0000
Vasilis Vlachoudis <Vasilis.Vlachoudis at cern.ch> wrote:
> Hi all
>
> I am using the ttk.Notebook for an editor like application and I want
> to implement something like autohide functionality for the tabheadings
> when there is only one tab, and to reappear when there are more than
> one.
>
> Is there some function to set the height to 0 for the headings of
> "pack_forget" equivalent in the style?
it seems you can show or hide the tabs with something like:
s=ttk.Style()
# store default layout options
tablayout = s.layout('TNotebook.Tab')
# hide tabs
s.layout('TNotebook.Tab', [])
# show tabs again
s.layout('TNotebook.Tab',tablayout)
Idea borrowed from:
https://stackoverflow.com/questions/26923010/how-do-i-hide-the-entire-tab-bar-in-a-tkinter-ttk-notebook-widget
Best regards
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
There is an old custom among my people. When a woman saves a man's
life, he is grateful.
-- Nona, the Kanuto witch woman, "A Private Little War",
stardate 4211.8.
More information about the Tkinter-discuss
mailing list