【发布时间】:2022-01-19 21:23:25
【问题描述】:
我正在使用 Tkinter 开发一个 python 应用程序,并且我正在使用来自 awthemes 的 awdark 主题来使我的应用程序具有出色的外观。主题看起来非常好,但我通过查看awthemes website 意识到可以通过更改例如setHighlightColor 的图形颜色来个性化主题。似乎有很多自定义可能,但它们没有在 python 中显示具体示例,只是一些这样的代码:
package require awthemes
::themeutils::setHighlightColor awdark #007000
package require awdark
经过几次尝试,我都没有设法自定义主题,也没有在谷歌上找到任何东西,所以我请求你的帮助。
这是我的python代码:
from tkinter import *
from tkinter import ttk
root = Tk()
# Create some random widgets to see the changes
notebook = ttk.Notebook(root)
notebook.grid(row=0, column=0, sticky='nsew')
global_frame = ttk.Frame(notebook)
global_frame.grid(row=0, column=0)
notebook.add(global_frame, text="Tab1")
ttk.Radiobutton(global_frame, text="Radio 1").grid(row=0, column=0)
ttk.Radiobutton(global_frame, text="Radio 2").grid(row=0, column=1)
ttk.Progressbar(global_frame, value=75).grid(row=1, column=0, columnspan=2)
# Create a style and import the awdark theme
style = ttk.Style()
root.tk.call('lappend', 'auto_path', '/Users/marinnagy/Downloads/awthemes-10.4.0')
root.tk.call('package', 'require', 'awdark')
style.theme_use('awdark')
root.mainloop()
当前的图形界面看起来像this,如何将图形颜色更改为this picture中的绿色?
【问题讨论】: