Search code examples
tcltk-toolkitttk

How to "gray out" or disable tabs in ttkNotebook?


I am going through the ttk notebook manual found here, but I cannot seem to find something that would do the affect stated in the title. The closest thing I see is the hide tab option, but I would like for it to be disabled instead of hidden. Is there a way to achieve in this in tcl/tk, specifically in an R setting?


Solution

  • Every tab of a notebook has a -state option (as well as several for controlling the contents of the tab itself), which can be normal (the default), hidden (which conceals the tab entirely) or disabled (the tab is there but cant be chosen, and is visually disabled too). You want that last option. These options are configured through the tab method of the notebook widget or are given when you add the tab.

    $nb tab $tab -state disabled
    

    The $tab (for the tab method) can be either the name of the slave widget that is the body of the tab, or the index within the tab list. (Or a few other things that probably aren't so useful to you.)