如何在Ubuntu的Pygame中将图片设置为应用程序图标

问题描述

我想在ubuntu-20.04上的pygame中将图像设置为应用程序图标。

我的代码是:

#!/usr/bin/python
import pygame as pg

#initialize:
pg.init()

#strating the game! creating window:
pg.display.set_mode((600,600))

#title and icon:
#title of window:
pg.display.set_caption('Space invaders')

#Window Icon:
#Load image:
Icon = pg.image.load(f'/home/ilia/Downloads/ufo.png')
#use image:
pg.display.set_icon(Icon)

#game loop
run_status = True
while run_status:
    for event in pg.event.get():
        if event.type == pg.QUIT:
            run_status = False

,我的ufo.png也是32X32。但它不起作用,但我的应用程序图标仍然无效:

enter image description here

我该怎么办?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)