Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ttk:: configuration

60 views
Skip to first unread message

Zoltan Kocsi

unread,
May 15, 2018, 5:35:46 AM5/15/18
to
This issue is similar to the thread
"Configure background of ttk::combobox"
about a month ago.

First of all, is there some actual, detailed documentation (apart
from the ttk source code) about the whole ttk:: internals, how the
widgets are built, how the config of elements works and so on and so
forth? The man page for ttk::style is not overly helpful. It's probably
a very good reminder for the people who wrote ttk but I doubt that
garden variety laymen like me can grasp the intricacies of ttk from
that (or from the Tcl book, for that matter). Pointers to any such
documentation would be most welcome.

Then also, is there a reason why the combobox behaves the way it does?
Tcl/Tk 8.6 on Linux:

- If the combobox content is chosen from the list, it will also be
selected (i.e. have a highlighted background). Why?

- If the combobox is disabled, then it will change the text to grey on
grey *but* the select button remains the same as before (i.e. high
contrast arrow) even though it doesn't do anything. This is most
confusing, because when one disables the widget the actual, immutable
selection should still be well readable (as it can still be changed
from the program) but the now non-functioning button should indicate
that pressing it is a futile exercise. Interestingly, the spinbox
does indeed grey its buttons when disabled, so the behaviour is not
consistent between ttk widgets.

- The combobox has a config, -foreground which seems to set the colour
of the text. It also has a -background, which probably sets
something, but no matter what I did, I could not make any part of the
widget show the colour set by that option.

Lastly, a question about the future. Are there any plans to make a Tk
widget set based on the native widgets of the platform? Not widgets
that try to look like native ones, but wrappers around the actual real
ones? Like what wxWidgets does? Of course with a fall-back to, say,
ttk, if the target has no native widget set at all.

Thanks,

Zoltan
--
Zoltán Kócsi
Bendor Research Pty. Ltd.

Brad Lanam

unread,
May 15, 2018, 8:10:53 AM5/15/18
to
On Tuesday, May 15, 2018 at 2:35:46 AM UTC-7, Zoltan Kocsi wrote:
> This issue is similar to the thread
> "Configure background of ttk::combobox"
> about a month ago.
>
> First of all, is there some actual, detailed documentation (apart
> from the ttk source code) about the whole ttk:: internals, how the
> widgets are built, how the config of elements works and so on and so
> forth? The man page for ttk::style is not overly helpful. It's probably
> a very good reminder for the people who wrote ttk but I doubt that
> garden variety laymen like me can grasp the intricacies of ttk from
> that (or from the Tcl book, for that matter). Pointers to any such
> documentation would be most welcome.

Not really. Run `ttk::style layout` on various widgets.
and study the the layout of some of the ttk widget styles.
Different themes may have different layouts.
And the various themes set the colors in their own fashion.

I created this wiki page detailing how to change
the colors: http://wiki.tcl.tk/37973

The ttk::progressbar section has an example of changing the elements on
windows (from http://wiki.tcl.tk/20059).

I also created this page: http://wiki.tcl.tk/54685 showing how to add
an additional element.

The manual pages have had an update to include some basic documentation
on what style configuration options are available. If you can find the
right person to push, they could update the online manual pages to the
new version of manual pages.

> Then also, is there a reason why the combobox behaves the way it does?
> Tcl/Tk 8.6 on Linux:
>
> - If the combobox content is chosen from the list, it will also be
> selected (i.e. have a highlighted background). Why?

Do not know.

> - The combobox has a config, -foreground which seems to set the colour
> of the text. It also has a -background, which probably sets
> something, but no matter what I did, I could not make any part of the
> widget show the colour set by that option.

There is very little -background that is visible.
You may see the change behind the arrow buttons.

You can change the -fieldbackground. Some of the themes have a graphical
-fieldbackground and nothing will happen.
When using Mac OS X, -background sets the -fieldbackground (bug).



Harald Oehlmann

unread,
May 15, 2018, 1:07:03 PM5/15/18
to
Cudos to Brad for this work, highly appreciated, use it very often...
Thanks,
Harald

Koen Danckaert

unread,
May 16, 2018, 5:10:04 AM5/16/18
to
On 15/05/2018 11:34, Zoltan Kocsi wrote:

> Then also, is there a reason why the combobox behaves the way it does?
> Tcl/Tk 8.6 on Linux:
>
> - If the combobox content is chosen from the list, it will also be
> selected (i.e. have a highlighted background). Why?

I think this is more or less standard behaviour for comboboxes. Note
that you can use -exportselection 0 to avoid setting the global selection.

>
> - If the combobox is disabled, then it will change the text to grey on
> grey *but* the select button remains the same as before (i.e. high
> contrast arrow) even though it doesn't do anything. This is most
> confusing, because when one disables the widget the actual, immutable
> selection should still be well readable (as it can still be changed
> from the program) but the now non-functioning button should indicate
> that pressing it is a futile exercise. Interestingly, the spinbox
> does indeed grey its buttons when disabled, so the behaviour is not
> consistent between ttk widgets.
>

I think this was fixed in Tk 8.6.7, in response to a message from you on
this list ;-) See
https://groups.google.com/d/msg/comp.lang.tcl/XT_i7wwdCnM/ZOIadjAoBQAJ
https://core.tcl.tk/tk/tktview?name=c492c96aa2

--Koen

Zoltan Kocsi

unread,
May 16, 2018, 9:07:57 AM5/16/18
to
Brad,

Thanks a lot! Very helpful write-ups!

Zoltan Kocsi

unread,
May 16, 2018, 9:13:21 AM5/16/18
to
On Wed, 16 May 2018 11:10:01 +0200
Koen Danckaert <ko...@nospam.invalid> wrote:

> > - If the combobox content is chosen from the list, it will also be
> > selected (i.e. have a highlighted background). Why?
>
> I think this is more or less standard behaviour for comboboxes. Note
> that you can use -exportselection 0 to avoid setting the global
> selection.

Well, at the moment I just capture the event when an element from the
list gets selected and delete the selection. So there's a solution, I
just don't get the logic behind it. If I enter some text into the box,
that doesn't get selected. But if I choose an entry from the list, it
does.

> > - If the combobox is disabled, then it will change the text to grey
> > [...]
>
> I think this was fixed in Tk 8.6.7, in response to a message from you
> on this list ;-) See
> https://groups.google.com/d/msg/comp.lang.tcl/XT_i7wwdCnM/ZOIadjAoBQAJ
> https://core.tcl.tk/tk/tktview?name=c492c96aa2

Oh. So it's one of my recurring issues... Sorry about that and thanks
for the info on 8.6.7.

Regards,
0 new messages