I want to have a ttk::combobox with white foreground and black
background everywhere, and in whatever the widget state is.
According to ttk::style layout TCombobox, there are elements :
textarea, downarrow, field. So I tried to map the states bg and fg for
these elements but :
- the pulldown arrow itself stays black (so invisible on a black
background)
- the items in the pull-down listbox stay with default colors.
Are there some hidden elements (is that is called sub-layouts ?) that
should be mapped also ? Or am i missing something else ?
Here is my test code :
ttk::style configure wb.TCombobox -background black -foreground white
foreach e {"" ".textarea" ".field" ".downarrow"} {
ttk::style map wb.TCombobox$e \
-background [list active black disabled black readonly black] \
-foreground [list active white disabled white readonly white] \
-fieldbackground [list active black disabled black readonly
black] \
-fieldforeground [list active white disabled white readonly
white] \
-selectbackground [list active black disabled black readonly
black] \
-selectforeground [list active white disabled white readonly
white] \
-disabledbackground [list active black disabled black readonly
black] \
-disabledforeground [list active white disabled white readonly
white]
}
pack [ttk::combobox .c \
-style wb.TCombobox \
-state readonly \
-values [list aezrty qsdfgh poiuyt]]
Thanks for your help !!
Luc
Instrospect which options are supported by downarrow
% ttk::style element option downarrow
-background -relief -borderwidth -arrowcolor -arrowsize
Then configure the (obvious) option
% ttk::style configure wb.TCombobox -background black -foreground
white \
-arrowcolor white
The set of supported options is, however, theme dependant.
> - the items in the pull-down listbox stay with default colors.
The dropdown is a regular listbox inside an override-redirect
toplevel,
which are children of the combobox. The simplest way is to use the
option
database
% option add *TCombobox*Listbox.foreground white
% option add *TCombobox*Listbox.background black
You might want to configure selectforeground, selectbackground and
selectborderwidth too.
Regards
Emiliano