[PyQt] Problem with QSystemTrayIcon.showMessage

Kálmán Viktor viktorvector at gmail.com
Wed Apr 3 09:44:42 BST 2019


It displays the application name there, I don't think you can hide that, at
least Qt doesn't have an option for it (
https://doc.qt.io/qt-5/qsystemtrayicon.html#showMessage).
It display Python because you are running it via the python interpreter,
once you have built your application for it will display a proper name.
As for the 2nd message it's on Windows, it's either a cache issue (it
usually resolves after a while) or a bug in Windows:
https://answers.microsoft.com/en-us/windows/forum/windows_10-other_settings/what-does-this-mean/104c2e8a-fb3b-4ef9-8ae8-8471e8ebe3f8

Zdenko Podobny <zdenop at gmail.com> ezt írta (időpont: 2019. ápr. 1., H,
18:40):

> Hello,
>
> I try to create systemtray application and I have some issue
> with showMessage function:
> When message is shown (e.g. when calling settings or exit function) -
> message is show but with additional information like "python" or
> "Microsoft.Exploror.....":
>
>    1. [image: image.png]
>    [image: image.png]
>
> How to hide is?
>
> Here is my code:
>
> import sys
> from PyQt5 import QtCore, QtGui, QtWidgets
>
>
> class SystemTrayIcon(QtWidgets.QSystemTrayIcon):
>
>     def __init__(self, icon, parent=None):
>         QtWidgets.QSystemTrayIcon.__init__(self, icon, parent)
>         self.menu = QtWidgets.QMenu(parent)
>         settingsAction = self.menu.addAction(self.tr("Settings..."))
>         settingsAction.triggered.connect(self.settings)
>         exitAction = self.menu.addAction(self.tr("Exit"))
>         exitAction.triggered.connect(self.exit)
>         self.setContextMenu(self.menu)
>         self.show()
>         self.showMessage("My app", "App started!", msecs=1000)
>
>     def exit(self):
>         QtCore.QCoreApplication.exit()
>         self.showMessage("My app", "Quitting...", msecs=1000)
>         self.hide()
>
>     def settings(self):
>         self.showMessage("My app", "Not implemented yet...", msecs=1000)
>
>
> app = QtWidgets.QApplication(sys.argv)
> widget = QtWidgets.QWidget()
> trayIcon = SystemTrayIcon(QtGui.QIcon('logo.ico'), widget)
> sys.exit(app.exec_())
>
>
> I use PyQt5-5.12.1-5.12.2-cp35.cp36.cp37.cp38-none-win_amd64.whl (on
> Windows 10)
>
> Zdenko
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190403/56ed64dc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 38803 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190403/56ed64dc/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 47110 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190403/56ed64dc/attachment-0003.png>


More information about the PyQt mailing list