python - 为 Tkinter 安装 ttk 主题
问题描述
我目前正在尝试使我使用 tkinter 构建的一些应用程序看起来更好。我读到您可以使用 ttk 更改 tkinter 的主题,并使其与内置主题一起使用。
import tkinter.ttk as ttk
from tkinter import *
import ttkthemes
root = Tk()
root.geometry('400x200')
ttk.Style().theme_use('alt')
Button1 =ttk.Button(text="Test").pack()
root.mainloop()
但是由于内置的有点过时了,我开始尝试从这个列表中安装外部的:https ://wiki.tcl-lang.org/page/List+of+ttk+Themes 。我尝试pip install ttkthemes
并希望让“Adapta”主题发挥作用(https://ttkthemes.readthedocs.io/en/latest/themes.html)。我尝试导入 ttkthemes,但无法正常工作。Python 执行时找不到主题_tkinter.TclError: can't find package ttk::theme::adapta
。那么如何将这些外部主题导入python?
解决方案
推荐阅读
- sql - 如何为以下问题做出选择语句?
- vsto - VSTO 功能区命令重新启动 Office.js 加载项
- dataframe - 仅在数据框中存在列时应用条件
- php - 如何使用 php 将 API 中的数据图像保存在服务器上?
- asp.net - 将 varchar 转换为 datetime 数据类型
- node.js - 如何从 Sendgrid 响应中获取嵌入动态参数的渲染模板?
- html - 当通过 Ctrl+A 清除值并且上一个值与假设为新值相同时,角度输入框值未从 ngModelChange 事件更新
- python - 用 Python 在图像上编写乌尔都语文本
- ui-automation - Blue Prism 使用 UI 自动化识别:2 个同名编辑字段
- java - 生产者可以拥有相同的 clientId 并发布到 Artemis 中的主题吗?