2

I have created static(PNG) image as tray icon with pyqt.

Did the same with GIF image results in static tray icon. Can it animated in system tray with pyqt?

QtGui.QSystemTrayIcon.__init__(self, parent)
self.setIcon(QtGui.QIcon("Image.gif"))
warvariuc
  • 57,116
  • 41
  • 173
  • 227
makalways
  • 21
  • 1
  • 3

1 Answers1

3

Use QMovie to play the animated gif, and update the tray icon on each new frame event:

m_icon = new QSystemTrayIcon();
m_icon->show();
m_gif = new QMovie(":/animated.gif");
connect(m_gif, SIGNAL(frameChanged(int)), this, SLOT(updateIcon()));
m_gif->start();

...

void MyWidget::updateIcon()
{
    m_icon->setIcon(m_gif->currentPixmap());
}

Sorry for the C++ example, I don't have PyQt installed.

dabhaid
  • 3,849
  • 22
  • 30