Fix: Show tray message without defining an icon

Calling self.TrayIcon.showMessage without an icon file gives this error (at least on Windows7 64bit / python3.7.1 64bit) 

TypeError: 'PySide2.QtWidgets.QSystemTrayIcon.showMessage' called with wrong argument types:
  PySide2.QtWidgets.QSystemTrayIcon.showMessage(str, str, int)
Supported signatures:
  PySide2.QtWidgets.QSystemTrayIcon.showMessage(unicode, unicode, PySide2.QtWidgets.QSystemTrayIcon.MessageIcon = QSystemTrayIcon.Information, int = 10000)
  PySide2.QtWidgets.QSystemTrayIcon.showMessage(unicode, unicode, PySide2.QtGui.QIcon, int = 10000)

Passing an empty QIcon() fixes the problem for me.
This commit is contained in:
mborus 2018-12-15 11:34:57 +01:00 committed by GitHub
parent 1e1926cdc0
commit ed654aae17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -2933,7 +2933,7 @@ class SystemTray:
elif messageicon is not None: elif messageicon is not None:
self.TrayIcon.showMessage(title, message, messageicon, time) self.TrayIcon.showMessage(title, message, messageicon, time)
else: else:
self.TrayIcon.showMessage(title, message, time) self.TrayIcon.showMessage(title, message, QIcon(), time)
self.LastMessage = message self.LastMessage = message
self.LastTitle = title self.LastTitle = title