Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 有没有办法将(动画)GIF图像作为pyqt的系统托盘图标?_Python_Qt_Pyqt_System Tray - Fatal编程技术网

Python 有没有办法将(动画)GIF图像作为pyqt的系统托盘图标?

Python 有没有办法将(动画)GIF图像作为pyqt的系统托盘图标?,python,qt,pyqt,system-tray,Python,Qt,Pyqt,System Tray,我已经用pyqt创建了静态(PNG)图像作为托盘图标 对静态托盘图标中的GIF图像结果执行相同操作。是否可以使用pyqt在系统托盘中设置动画 QtGui.QSystemTrayIcon.__init__(self, parent) self.setIcon(QtGui.QIcon("Image.gif")) 使用QMovie播放动画gif,并在每个新帧事件上更新托盘图标: m_icon = new QSystemTrayIcon(); m_icon->show(); m_gif = ne

我已经用pyqt创建了静态(PNG)图像作为托盘图标

对静态托盘图标中的GIF图像结果执行相同操作。是否可以使用pyqt在系统托盘中设置动画

QtGui.QSystemTrayIcon.__init__(self, parent)
self.setIcon(QtGui.QIcon("Image.gif"))

使用
QMovie
播放动画gif,并在每个新帧事件上更新托盘图标:

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();

对不起,对于C++示例,我没有安装PyQt。
void MyWidget::updateIcon()
{
    m_icon->setIcon(m_gif->currentPixmap());
}