更改窗口布局,看起来像Ubuntu Black / Orange /

时间:2016-05-24 18:55:27

标签: python tkinter

我在Python和Java中创建自己的应用程序。

我想更改应用程序的布局/设计。所以我没有采用标准的Windows窗口设计,而是希望它与Ubuntu设计类似,黑色和橙色设计。

我不知道,如果可能的话,那就是我要问的原因。

1 个答案:

答案 0 :(得分:-1)

如果您正在使用python3 tkinter和ttk,您可以创建自己的主题并将颜色更改为类似于ubuntu样式的内容,但请说明您使用的python模块来创建gui

例如

import tkinter
from tkinter import ttk

mycolour = "color code here"
mybackground = "color code here"

style = ttk.Style()

style.theme_create( "custom_theme", parent="alt", settings={
    "TNotebook": {"configure": {"tabmargins": [2, 5, 2, 0] } },
    "TNotebook.Tab": {
        "configure": {"padding": [5, 1], "background": mycolour },
        "map":       {"background": [("selected", mybackground)],
                      "expand": [("selected", [1, 1, 1, 0])] } } } )


style.theme_use("custom_theme")