Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change icon in title QMessageBox in Qt, python

How to change or delete icon in title QMessageBox in Qt, python. I have next cod:

msgBox = QtGui.QMessageBox(QtGui.QMessageBox.Information, ' ', 'Completed',
                           buttons=QtGui.QMessageBox.Yes)
msgBox.setWindowFlags(QtCore.Qt.FramelessWindowHint |
                      QtCore.Qt.WindowTitleHint)
msgBox.exec_()

When msgBox appear in monitor, no icon and text in title, but on task bar I see the standart icon Windows. it's not beautiful.

like image 439
Teit Avatar asked Feb 28 '16 08:02

Teit


1 Answers

You can do it like this:

msgBox.setWindowIcon(QtGui.QIcon('PathToIcon/icon.png'))
like image 59
Artem Zh. Avatar answered Oct 24 '22 07:10

Artem Zh.