python 使用libnotify显示通知时可以使用哪些图标?

fnatzsnv  于 2023-08-02  发布在  Python
关注(0)|答案(3)|浏览(107)

我正在使用libnotify库在Ubuntu中显示通知。我希望显示某种类型的电池(因为我的应用程序是电池表)。
我可以使用的图标类型有:
1.指定图标文件名的URI(例如file://path/to/my-icon.png)
1.“股票”图标名称。一个会成功调用gtk_icontheme_lookup()的函数(例如'stock-delete')注意:这些不一定是普通的GTK图标-任何主题图标都可以工作。
1.像素缓冲器
我最好使用选项#2,但是我找不到可用图标的名称。如何找到可用的图标?

nnsrf1az

nnsrf1az1#

你可以使用pygtk本身轻松找到:

>>> import gtk
>>> print "\n".join(name for name in dir(gtk) if name.startswith("STOCK_"))

字符串
在我的机器上,这将打印:

STOCK_ABOUT
STOCK_ADD
STOCK_APPLY
STOCK_BOLD
STOCK_CANCEL
STOCK_CAPS_LOCK_WARNING
STOCK_CDROM
STOCK_CLEAR
STOCK_CLOSE
STOCK_COLOR_PICKER
STOCK_CONNECT
STOCK_CONVERT
STOCK_COPY
STOCK_CUT
STOCK_DELETE
STOCK_DIALOG_AUTHENTICATION
STOCK_DIALOG_ERROR
STOCK_DIALOG_INFO
STOCK_DIALOG_QUESTION
STOCK_DIALOG_WARNING
STOCK_DIRECTORY
STOCK_DISCARD
STOCK_DISCONNECT
STOCK_DND
STOCK_DND_MULTIPLE
STOCK_EDIT
STOCK_EXECUTE
STOCK_FILE
STOCK_FIND
STOCK_FIND_AND_REPLACE
STOCK_FLOPPY
STOCK_FULLSCREEN
STOCK_GOTO_BOTTOM
STOCK_GOTO_FIRST
STOCK_GOTO_LAST
STOCK_GOTO_TOP
STOCK_GO_BACK
STOCK_GO_DOWN
STOCK_GO_FORWARD
STOCK_GO_UP
STOCK_HARDDISK
STOCK_HELP
STOCK_HOME
STOCK_INDENT
STOCK_INDEX
STOCK_INFO
STOCK_ITALIC
STOCK_JUMP_TO
STOCK_JUSTIFY_CENTER
STOCK_JUSTIFY_FILL
STOCK_JUSTIFY_LEFT
STOCK_JUSTIFY_RIGHT
STOCK_LEAVE_FULLSCREEN
STOCK_MEDIA_FORWARD
STOCK_MEDIA_NEXT
STOCK_MEDIA_PAUSE
STOCK_MEDIA_PLAY
STOCK_MEDIA_PREVIOUS
STOCK_MEDIA_RECORD
STOCK_MEDIA_REWIND
STOCK_MEDIA_STOP
STOCK_MISSING_IMAGE
STOCK_NETWORK
STOCK_NEW
STOCK_NO
STOCK_OK
STOCK_OPEN
STOCK_ORIENTATION_LANDSCAPE
STOCK_ORIENTATION_PORTRAIT
STOCK_ORIENTATION_REVERSE_LANDSCAPE
STOCK_ORIENTATION_REVERSE_PORTRAIT
STOCK_PAGE_SETUP
STOCK_PASTE
STOCK_PREFERENCES
STOCK_PRINT
STOCK_PRINT_ERROR
STOCK_PRINT_PAUSED
STOCK_PRINT_PREVIEW
STOCK_PRINT_REPORT
STOCK_PRINT_WARNING
STOCK_PROPERTIES
STOCK_QUIT
STOCK_REDO
STOCK_REFRESH
STOCK_REMOVE
STOCK_REVERT_TO_SAVED
STOCK_SAVE
STOCK_SAVE_AS
STOCK_SELECT_ALL
STOCK_SELECT_COLOR
STOCK_SELECT_FONT
STOCK_SORT_ASCENDING
STOCK_SORT_DESCENDING
STOCK_SPELL_CHECK
STOCK_STOP
STOCK_STRIKETHROUGH
STOCK_UNDELETE
STOCK_UNDERLINE
STOCK_UNDO
STOCK_UNINDENT
STOCK_YES
STOCK_ZOOM_100
STOCK_ZOOM_FIT
STOCK_ZOOM_IN
STOCK_ZOOM_OUT

bwntbbo3

bwntbbo32#

您可以在Free Desktop Icon Naming Specification中查找它。看起来你需要的图标是“电池”、“电池警告”和“电池电量不足”。

krugob8w

krugob8w3#

图标在“freedesktop icon-theme-spec”中指定,您可以在这里阅读:
https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout

  • 因此,图标“可用”在以下任何文件夹中:

主页/.icons
/usr/share/icons
/usr/share/pixmap

相关问题