应用程序图标替换为树莓派任务栏上的标准图标

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

我使用自己的应用程序图标 (32x32) 为我的 python 应用程序创建了一个 .desktop 文件。该图标在系统菜单和任务栏(应用程序启动栏)上显示正确。启动应用程序后,该图标会显示在 Ubuntu 中的任务栏中,但在 Raspberry Pi 上,正在运行的应用程序的图标会被一些默认的类似终端的图标替换。

.desktop 文件位于 ~/.local/share/applications 文件夹中,如下所示:

[Desktop Entry]
Name=Infrared Camera
Comment=Take photos with both the infrared and visible light camera
Icon=/home/roland/projects/pi_thermal_camera/icon.png
Exec=/home/roland/projects/pi_thermal_camera/IR_Photo_buttons.py
Type=Application
Encoding=UTF-8
Terminal=false
Categories=Other;

这是 32x32 像素的 icon.png:

icon.png

这是启动应用程序后显示的图标:

the icon shown after starting the app

这是启动应用程序后任务栏的屏幕截图:

screenshot of task bar with different icons for the same app

红色和蓝色图标是任务栏上的一个菜单项,单击它后我的红外应用程序将打开,并为正在运行的应用程序添加一个类似终端的图标。

当我的应用程序开始运行时,如何才能显示我自己的漂亮图标而不是默认图标?

raspberry-pi icons taskbar raspbian-buster
1个回答
0
投票

下面类似的东西适用于较旧的操作系统版本,但不适用于 Bookworm

root.iconphoto(True, tk.PhotoImage(file=os.path.join(program_directory, "myicon.png")))

看照片

© www.soinside.com 2019 - 2024. All rights reserved.