3

With this code fragment, I would expect the label to have a background color red. def createWidgets(self):

    style = ttk.Style()
    style.configure("Red.TLabel", foreground="green", background="red")

    self.label1 = ttk.Label(textvariable=self.numberArray[0][0],style="Red.TLabel")
    self.label1.pack()

I get the green foreground color but I can't change the background color. This is on OS X. I'm using ActiveState's tcl and python. The same problem occurs with Python 3.2 and 2.7

1 Answer 1

7

You'll sometimes try to change an option that is supposed to exist according to element options, but it will have no effect. As an example, you can't modify the background color of a button in the "aqua" theme used by Mac OS X. While there are valid reasons for these cases, at the moment its not easy to discover them, which can make experimenting frustrating at times.

Taken from this tutorial http://www.tkdocs.com/tutorial/styles.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.