【发布时间】:2021-08-08 11:18:31
【问题描述】:
我发现在 pyqt5 应用程序的任务栏管理器中附加相同的图标时遇到了麻烦,就像我为 pyqt5 应用程序的图标所做的那样。我在pyqt5中附加了下面的图标显示代码,只需要一些帮助来说明如何将应用程序的相同图标显示到任务栏。
import sys
from SplashScreen import *
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QColor, qGray, QImage, QPainter, QPalette,QIcon
from PyQt5.QtCore import Qt, QUrl
from PyQt5.QtWidgets import QApplication, QWidget
if __name__ == "__main__":
app = QApplication(sys.argv)
app.setWindowIcon(QIcon('./cricket.png'))
w = QWidget()
w.resize(300,300)
w.setWindowTitle('Quick Cricket')
w.show()
sys.exit(app.exec_())
提前致谢
【问题讨论】:
-
请将代码发布为文本,而不是图像。然后,确保您提供minimal, reproducible example。
-
import sys from SplashScreen import * from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtGui import QColor, qGray, QImage, QPainter, QPalette,QIcon from PyQt5.QtCore import Qt, QUrl from PyQt5.QtWidgets import QApplication, QWidget if __name__ == "__main__": app = QApplication(sys.argv) app.setWindowIcon(QIcon('./cricket.png')) w = QWidget() w.resize(300,300) w.setWindowTitle('Quick Cricket') w.show() sys.exit(app.exec_()) -
这里是示例代码
-
不要使用 cmets,因为它们不支持格式化并且难以阅读代码。请改为编辑问题,并遵循有关 formatting code 的准则。
-
@musicamante 仍在等待答复
标签: python user-interface pyqt5