简体   繁体   English

ttk.Style不起作用,尽管ttk确实运行了我的命令

[英]ttk.Style not working although ttk does run my commands

Im trying to edit the style of my program using ttk.Style, so I wrote this 我试图使用ttk.Style编辑程序的样式,所以我写了这个

import tkinter as tk
import tkinter.ttk as ttk
class Application:
    def __init__(self):
        self.root = tk.Tk()
        self.root.minsize(width=400, height=400)
        self.root.maxsize(width=400, height=400)
        self.root.resizable(False, False)
        self.theme = ttk.Style()
        self.theme.theme_use('clam')
        self.button = tk.Button(self.root, text='Test')
        self.button.pack()

Yet when I run the code, nothing changes. 但是,当我运行代码时,没有任何变化。 I printed theme_use() and the theme is clam like I set, yet nothing happens. 我打印了theme_use(),主题像我设置的那样是蛤,但是什么也没发生。 Is there anything I am doing wrong? 我做错了什么吗?

You aren't using any ttk widgets. 您没有使用任何ttk小部件。 The style only affects ttk widgets. 样式仅影响ttk小部件。

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

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