如何安装 Python ttk 主题

How to install Python ttk themes

这是我第一次 post SO,所以如果我做错了什么,请随时纠正我!

我正在 Windows 上为我的 Raspberry Pi(运行 Raspbian stretch)制作一个简单的 GUI(因为我可以在那里使用 PyCharm)。 我想从 this site 安装第三方主题,并已按照 wiki 上的说明进行操作。然而,在 Windows 和 Raspbian 上,它似乎安装正确,没有任何错误,但是当我通过这样做检查 ttk 时:

import tkinter.ttk
tkinter.ttk.Style().theme_names()

它仍然显示各个操作系统的默认主题。

我也看过这个 SO post (How to find or install themes tkinter ttk for Python),但是那里没有相关的答案。

编辑: 我现在知道如何在常规 tkinter/ttk GUI 中使用主题,但我想安装这些主题,以便它们像内置的一样那些,因为我正在使用使用 tkinter 和 ttk 的 appJar 模块。

非常感谢任何帮助和指导!

你导入他们的包了吗?根据他们的 current 文档,您基本上可以通过以下方式检查主题:

from ttkthemes import themed_tk as tk   
import ttk   #(might need to add tkinter. beforehand)
window = tk.ThemedTk()
window.get_themes()

你试过那个方法吗?

appJar 对 ttk 的支持仍在开发中,但您可以尝试覆盖默认样式:

from ttkthemes import ThemedStyle
app = gui(useTtk=True)
app.ttkStyle = ThemedStyle(app.topLevel)
app.ttkStyle.set_theme("plastik")

这会告诉 appJar 使用 ttk,但随后会将 appJar 使用的样式替换为您请求的样式。