How to change background color for a CheckList widget from tkinter.tix module?

421 Views Asked by At

I tried to google it but couldn't find out. I am trying to create a CheckList widget with a tkinter.tix package in Python3.5 and set background color to white with this code:

from tkinter import tix as tk
checklist = tk.CheckList(parent, browsecmd=br, width=650)
checklist.tk_setPalette(background="white")

Unluckily all of the widgets on the screen got white background.

I have tried

checklist = tk.CheckList(parent, browsecmd=br, width=650, background="white")

but it seems not to have any effect on the background of CheckList

any ideas?

2

There are 2 best solutions below

0
TheOne On

Try to modify background option afterwards declaration with .config function of the CheckList. In particular:

checklist=tk.CheckList()
checklist.pack()
checklist.config(bg='blue')

Most of the tkinter widget are likely to work in that way...

0
king_fisher09 On

I know this is a year late but I found the answer:

checklist.hlist.config(bg='white')

is what you need.