On Saturday, December 1, 2012 9:58:02 AM UTC-8,
don.ro...@gmail.com wrote:
> Hi,
>
>
>
> I am trying to specify the background tab colors in a TNotebook, in particular the background color of the tab for the selected page, Here is an example of what I am trying to do:
>
>
>
> toplevel .top
>
> wm geometry .top 500x400+40+50;
>
> update
>
> .top configure -background wheat
>
> ttk::style configure TNotebook -background wheat
>
> ttk::style configure TNotebook.Tab -background plum
>
> ttk::style configure TNotebook.Tab -activetabbackground green
>
> ttk::notebook .top.nb -width 300 -height 200
>
> .top.nb add [frame .top.nb.f1 -bg wheat] -text "First tab"
>
> .top.nb add [frame .top.nb.f2 -bg wheat] -text "Second tab"
>
> .top.nb add [frame .top.nb.f3 -bg wheat] -text "Third tab"
>
> place .top.nb -in .top -x 100 -y 100
>
>
>
> I want the tabs for unselected pages to be one color and the tab for the selected page to be another. The above code colors my tabs for unselected pages plum. But I have not found a way to make the color of the tab of the selected page different from the default gray. I have guessed a long list of possible option names but haven't found one that works.
> toplevel .top
wm geometry .top 500x400+40+50;
update
.top configure -background wheat
ttk::style configure TNotebook -background wheat
ttk::style configure TNotebook.Tab -background plum
ttk::style map TNotebook.Tab -background [list disabled plum selected green]
ttk::notebook .top.nb -width 300 -height 200
.top.nb add [frame .top.nb.f1 -bg wheat] -text "First tab"
.top.nb add [frame .top.nb.f2 -bg wheat] -text "Second tab"
.top.nb add [frame .top.nb.f3 -bg wheat] -text "Third tab"
place .top.nb -in .top -x 100 -y 100
>
>
> Is it possible to specify the background color of the selected page in a notebook? If so how? It seems that the authors could not have overlooked that aspect of style, so I must be missing something! If I have missed some documentation, I apologize for taking your time.
>
>
>
> Thanks in Advance,
>
> Don
I think that I solved my own problem. Consider the revised example:
toplevel .top
wm geometry .top 500x400+40+50;
update
.top configure -background wheat
ttk::style configure TNotebook -background wheat
ttk::style configure TNotebook.Tab -background plum
ttk::style map TNotebook.Tab -background [list disabled plum selected green]
ttk::notebook .top.nb -width 300 -height 200
.top.nb add [frame .top.nb.f1 -bg wheat] -text "First tab"
.top.nb add [frame .top.nb.f2 -bg wheat] -text "Second tab"
.top.nb add [frame .top.nb.f3 -bg wheat] -text "Third tab"
place .top.nb -in .top -x 100 -y 100
It seems to work and I am thrilled. It was found by random experimentation. I don't understand why the developer implemented this feature when he was too lazy to tell any one it was there let alone about how to use it. I often feel that deplorable documentation is the Achilles heel of Open Software.