Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8015723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:19:56+00:00 2026-06-04T20:19:56+00:00

This is an example of code for simple system tray PyQt application. import sys

  • 0

This is an example of code for simple system tray PyQt application.

import sys
from PyQt4 import QtGui

def main():
   app = QtGui.QApplication(sys.argv)

   trayIcon = QtGui.QSystemTrayIcon(QtGui.QIcon('test.png'), app)
   menu = QtGui.QMenu()
   exitAction = menu.addAction("Exit")
   trayIcon.setContextMenu(menu)

   # I'd like to show picture in tooltip, BUT IT'S NOT WORK IN WINDOWS
   trayIcon.setTooltip('<img src="SomePicture.png" width="48" height="48"/>')

   trayIcon.show()
   sys.exit(app.exec_())

if __name__ == '__main__':
   main()

In this code I’d like to show balloon tooltip with a some picture and some kind of text formating. For this purpose I use RichText tags formatting. As the result for Ubuntu Linux system (Gnome desktop) everything is Ok. But when I try use RichText formatting for tooltip in Windows XP system, nothing works. Tooltip text equals source string: ”.
Python version on Windows 2.7, on Linux 2.6 but I think that problem is not in different versions.

If in Windows OS RichText isn’t parsing how can I make same kind of GUI (Crossplatform is prefered)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:19:57+00:00Added an answer on June 4, 2026 at 8:19 pm

    If someone also interested in create of balloon widget. This my code:

    class SystemTrayIcon(QtGui.QSystemTrayIcon):
        def __init__(self, parent = None): 
            QtGui.QSystemTrayIcon.__init__(self, icon, parent)
            traySignal = "activated(QSystemTrayIcon::ActivationReason)"
            self.connect(self, QtCore.SIGNAL(traySignal), self._activateRoutine)
            self.balloon = balloonWidget(name)
    
        def _activateRoutine(self, reason):
            if reason == QtGui.QSystemTrayIcon.Trigger:
                self.balloon.show(self.geometry())
    
    class balloonWidget(QtGui.QWidget):
        def __init__(self,name):
            QtGui.QWidget.__init__(self, parent = None, flags = QtCore.Qt.Popup)
    
            self.name = name
    
            self.offsetX = 10
            self.offsetY = 10
    
            self.outInfo = QtGui.QLabel(self)
    
            self.setStyleSheet("QWidget {border:5px solid rgb(170, 170, 255);}")
    
        def show(self,coord):
            richText = tr('Any text with Rich Format')
            self.outInfo.setText(richText)
            self.outInfo.show()
            self.adjustSize()
    
            origin = QtGui.QDesktopWidget().availableGeometry().bottomRight()
    
            if coord.y() < origin.y()/2:
                moveY = coord.bottomLeft().y() + self.offsetY
            else:
                moveY = coord.topLeft().y() - (self.height() + self.offsetY)
    
            if coord.x() + self.width() + self.offsetX >= origin.x():
                moveX = origin.x() - (self.width() + self.offsetX)
            else:
                moveX = coord.x()
    
            self.move(moveX,moveY)
            self.setVisible(True)
    
        def closeEvent(self, event):
            event.ignore()
            self.hide()
    
        def mousePressEvent(self, event):
            self.close()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting this error when I follow the simple code example from jsoncpp, that basically
In this very simple code example, messages get lost every once in a while.
I just tossed this super simple code example into a Flash CS4 IDE frame
Best explained with code I think, this is just a simple example: public class
I'm referring to SearchableDictionary v2 sample code in Adroid. In this example, in the
Language: asp This is sample of my code: str = www.example.com/gotobuy.aspx?id=1234 key_word = .obuy.
In this example code, I have a reference to ksoap2-android-assembly-2.6.3-jar-with-dependencies its incredible when do
Take this example code (ignore it being horribly inefficient for the moment) let listToString
In this example code, I'm trying to offset the Grid 's Canvas position by
In this example code it deals with framebuffers before setting up the context. I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.