python gtk黑色主题图标按钮

2024-05-16 03:01:47 发布

您现在位置:Python中文网/ 问答频道 /正文

将我的肉桂桌面上的主题更改为黑色主题(Adwaita dark)后,我不久前编写的一个程序现在显示的按钮不正确。例如,在其他程序(如文件管理器)中,图标的颜色现在为白色,但在这里它们保持为黑色

Button is dark mode but icon is light mode

我使用Gtk.Button.new_from_icon_name()创建了这些按钮:

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

...

button = Gtk.Button.new_from_icon_name("document-new", 1)

有没有办法让他们根据当前活动的主题自动调整颜色


Tags: namefromimport程序gtk主题new颜色
1条回答
网友
1楼 · 发布于 2024-05-16 03:01:47

我也遇到了同样的问题,最后使用了*-symbolic版本的图标。 根据Gnome docs

In the GNOME 3 designs we have identified a number of places where using a symbolic variant of a standard icon is desirable. Symbolic icons are usually low color or monochrome and intended to match the foreground font color. They may be used where a high color, detailed representation isn't warranted.

这意味着你宁愿使用

button = Gtk.Button.new_from_icon_name("document-new-symbolic", 1)

相关问题 更多 >