Using Kubuntu 18.04 (qt5 5.9.5), Python 3.6. I can't get this code to show the tray icon; other icons like Dropbox, etc. are shown, but this not:
import sys
from PyQt5.QtWidgets import QApplication, QMenu, QSystemTrayIcon, qApp, QMessageBox
from PyQt5.QtGui import QIcon
def run_something():
print("Running something...")
if __name__ == '__main__':
print("Creating application...")
app = QApplication(sys.argv)
print("Creating menu...")
menu = QMenu()
checkAction = menu.addAction("Check Now")
checkAction.triggered.connect(run_something)
quitAction = menu.addAction("Quit")
quitAction.triggered.connect(qApp.quit)
print("Creating icon...")
icon = QIcon.fromTheme("system-help")
print("Creating tray...")
trayIcon = QSystemTrayIcon(icon, app)
trayIcon.setContextMenu(menu)
print("Showing tray...")
trayIcon.show()
trayIcon.setToolTip("unko!")
trayIcon.showMessage("hoge", "moge")
print("Running application...")
sys.exit(app.exec_())
The message ("hoge", "moge") is shown, but I can't find the icon anywhere... Neither in the left upper corner, as other post says.
No idea why, but this code works, sing PySide2 (basically is the same code than above...):