如何使用两个Gtk.IconLookupFlags?

问题描述 投票:0回答:1

我想找到一个带有两个标志的应用程序图标(FORCE_SIZE和NO_SVG),但我不知道该怎么做!

我已经尝试过以下方法:

icon = Gio.content_type_get_icon(mimetype)
theme = Gtk.IconTheme.get_default()
info = theme.choose_icon(icon.get_names(), size, Gtk.IconLookupFlags.NO_SVG, Gtk.IconLookupFlags.FORCE_SIZE)

返回错误,因为我提供了3个以上的参数;

icon = Gio.content_type_get_icon(mimetype)
theme = Gtk.IconTheme.get_default()
info = theme.choose_icon(icon.get_names(), size, (Gtk.IconLookupFlags.NO_SVG, Gtk.IconLookupFlags.FORCE_SIZE))

返回错误,因为它要求FLAG类型而不是Tuple

icon = Gio.content_type_get_icon(mimetype)
theme = Gtk.IconTheme.get_default()
info = theme.choose_icon(icon.get_names(), size, Gtk.IconLookupFlags.NO_SVG and Gtk.IconLookupFlags.FORCE_SIZE)

返回错误大小的图标。

我已经尝试过搜索,但找不到任何问题的答案

python python-3.x gtk gtk3
1个回答
0
投票

你必须按位OR或标志来组合它们。

flags = Gtk.IconLookupFlags.NO_SVG | Gtk.IconLookupFlags.FORCE_SIZE
© www.soinside.com 2019 - 2024. All rights reserved.