5

I know we can modify the default style of a ttk::notebook tab using the following method :

ttk::style configure TNotebook.Tab -background red

My question is : is it possible to assign a custom style to individual tabs? Bascially, I would like something like this :

ttk::style configure TNotebook.Tab.Red -background red
ttk::style configure TNotebook.Tab.Green -background green

ttk::notebook .main.notebook
.main.notebook add .main.notebook.tab1 -text "I am red" -style TNotebook.Tab.Red
.main.notebook add .main.notebook.tab2 -text "I am green" -style TNotebook.Tab.Green

However, notebook tab options doesn't include a -style option. So is this possible?

user43791
  • 284
  • 2
  • 10
  • Good question. I suspect that you can't do it, but I don't know… – Donal Fellows Jan 21 '15 at 17:45
  • Since tabs obviously have their own styling already, wouldn't it be an "easy" feature to add? – user43791 Jan 21 '15 at 17:55
  • There was recently another request for tab styling, and even though it was a better use-case than yours, someone has to make the changes, or be convinced to make the changes. https://core.tcl-lang.org/tk/tktview?name=2782346 – Brad Lanam Jun 01 '20 at 19:32

1 Answers1

0

The short answer is no. There are no hooks and no accessible widgets you can choose to style tabs individually. The best you can do is use compound labels with images to give a little flare to the tabs.

bu11d0zer
  • 433
  • 4
  • 13