问题描述
限时送ChatGPT账号..这是我在 SO 上的第一篇文章,如果我做错了什么,请随时纠正我!
This is my first post on SO, so please feel free to correct me if I'm doing anything wrong!
我正在为 Windows 上的 Raspberry Pi(运行 Raspbian 拉伸)制作一个简单的 GUI(因为我可以在那里使用 PyCharm).我想从 本网站 安装第三方主题,并按照维基上的说明进行操作.然而,在 Windows 和 Raspbian 上,它似乎安装正确,没有任何错误,但是当我通过这样做检查 ttk 时:
I am making a simple GUI for my Raspberry Pi (that runs Raspbian stretch) on Windows (because I can use PyCharm on there). I am would like to install third party themes from this site and have followed the instructions on the wiki. However, on both Windows and Raspbian, it appears to install properly without any errors, but when I check for ttk by doing this:
import tkinter.ttk
tkinter.ttk.Style().theme_names()
它仍然显示各个操作系统的默认主题.
it still displays the default themes for the respective operating systems.
我也看过这篇 SO 帖子(How to find or install themes tkinter ttk for Python),但那里没有相关的答案.
I have also looked at this SO post (How to find or install themes tkinter ttk for Python), but there are no relevant answers on there.
我现在知道如何在常规 tkinter/ttk GUI 中使用主题,但我想安装这些主题,以便它们像内置主题一样工作,因为我正在使用appJar 使用 tkinter 和 ttk 的模块.
I now know how to use the themes in a regular tkinter/ttk GUI, but I would like to install these themes so they act like the built in ones, as I am using the appJar module that uses tkinter and ttk.
非常感谢任何帮助和指导!
Any help and guidance would be much appreciated!
推荐答案
appJar 对 ttk 的支持仍在开发中,但您可以尝试覆盖默认样式:
appJar's support for ttk is still in development, but you can try overriding the default style:
from ttkthemes import ThemedStyle
app = gui(useTtk=True)
app.ttkStyle = ThemedStyle(app.topLevel)
app.ttkStyle.set_theme("plastik")
这告诉 appJar 使用 ttk,但随后将 appJar 使用的样式替换为您请求的样式.
This tells appJar to use ttk, but then replaces the style appJar is using, with the style you request.
这篇关于如何安装 Python ttk 主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论