def __init__(self, file, parent=None): QGraphicsSvgItem.__init__(self, file, parent) self.animation = QGraphicsItemAnimation() self.animation.setItem(self) self.timeline = QTimeLine(300) self.animation.setTimeLine(self.timeline)