简体   繁体   English

Mac OSX的ttk的tkinter默认颜色样式是什么

[英]What is ttk's tkinter default color style for MAC OSX

I'm looking for either the exact colour name for ttk frames or for a way to dynamically retrieve that information. 我正在寻找ttk帧的确切颜色名称,或者寻找一种动态检索该信息的方法。 My problem is that the tkinter 我的问题是tkinter

root = tk()

and

button = ttk.Button()

give me two different widget background colours. 给我两种不同的小部件背景颜色。 This was not an issue when I developed the GUI on ubuntu linux , but the colours are different when I tried to run the code on MAC OSX 10.8.1 当我在ubuntu linux上开发GUI时,这不是问题,但是当我尝试在MAC OSX 10.8.1上运行代码时,颜色是不同的

I haven't been able to find any calls/attributes that would give me that information, and there are so many different colours it could be (white, light white, seashell white, etc...) 我一直找不到能给我该信息的呼叫/属性,并且可能有太多不同的颜色(白色,浅白色,贝壳白色等)。

Anyone know these default colour names? 有人知道这些默认颜色名称吗?

I'm using python 2.7.2, tkinter, ttk, MAC 10.8.1 我正在使用python 2.7.2,tkinter,ttk,MAC 10.8.1

I don't know how to get that information. 我不知道该如何获取这些信息。 The problem is, there may not be a single color for the background (it might be a slight gradient or pattern). 问题是,背景可能没有单一颜色(可能是轻微的渐变或图案)。 If the problem is that the background of your app looks wrong there's a simple trick: place a ttk.Frame() widget over the entire root window, and then just code as usual. 如果问题是应用程序的背景看起来不正确,则有一个简单的技巧:将ttk.Frame()小部件放在整个根窗口上,然后像往常一样编写代码。 As long as the stacking level of the frame is low, all your other widgets will appear above it. 只要框架的堆叠水平较低,所有其他小部件都将显示在框架上方。

I use place for this, giving an x and y of zero and a relwidth and relheight of 1.0. 我为此使用place ,给出x和y分别为零和relwidth和relheight为1.0。 Using place guarantees it would affect the use of pack or grid for all your other widgets. 使用place保证会影响所有其他小部件使用packgrid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM