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

white and black combobox.

26 views
Skip to first unread message

Luc Moulinier

unread,
Dec 2, 2010, 12:05:07 PM12/2/10
to

Hello !

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


Emiliano

unread,
Dec 3, 2010, 6:34:36 AM12/3/10
to
On 2 dic, 14:05, Luc Moulinier <luc.moulin...@igbmc.fr> wrote:
> Hello !
>
> 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)

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

0 new messages