【问题标题】:Use system default icons in Tkinter and Python3在 Tkinter 和 Python3 中使用系统默认图标
【发布时间】:2017-12-18 21:49:44
【问题描述】:

我想将系统默认图标用于已知任务(复制、剪切、粘贴、新建文件、打开文件、退出、帮助...)。这取决于桌面环境中当前使用的图标集和/或使用的操作系统。

Python 是否提供独立于平台的方式来获取此类图标?

这是一些基于 Tkinter 的伪代码

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from tkinter import *
from tkinter import ttk
from PIL import *

root = Tk()

image = image.open(DEFAULT_COPY_ICON)
image = ImageTk.PhotoImage(image)

button = Button(master=root, text='Copy', image=image))

root.mainloop()

【问题讨论】:

  • PyGTK 有系统图标的名称,但可能仅适用于 Linux。但是PyGTK 不是Tkinter
  • 您能为这些任务提供系统默认图标吗?例如,我质疑它们对于 Windows 的存在。
  • 我不确定它是否仅适用于 Linux。图标主题具有不同的格式(svg、png、...)和不同的文件夹组织。另外,我认为找到当前主题的方式取决于桌面环境。
  • @Nae MSDN 列出了几个窗口默认值here。编辑:用法here

标签: python-3.x tkinter python-imaging-library


【解决方案1】:

Python3 或 Tkinter 没有为此提供方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多