开发者

can't set background color ttk python os x using styles

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜