python - PyQt QMovie will not loop GIF -
i have working example of playing gif, isn't looping gif. changed movie.setcachemode(qmovie.cacheall)
any idea? -->animated gif
from pyqt4 import qtcore, qtgui pyqt4.qtgui import * pyqt4.qtcore import * import sys class imageplayer(qwidget): def __init__(self, filename, title, parent=none): qwidget.__init__(self, parent) # load file qmovie self.movie = qmovie(filename, qbytearray(), self) size = self.movie.scaledsize() self.setgeometry(200, 200, size.width(), size.height()) self.setwindowtitle(title) self.movie_screen = qlabel() # make label fit gif self.movie_screen.setsizepolicy(qsizepolicy.expanding, qsizepolicy.expanding) self.movie_screen.setalignment(qt.aligncenter) # create layout main_layout = qvboxlayout() main_layout.addwidget(self.movie_screen) self.setlayout(main_layout) # add qmovie object label self.movie.setcachemode(qmovie.cacheall) self.movie.setspeed(100) self.movie_screen.setmovie(self.movie) self.movie.start() self.movie.loopcount() if __name__ == "__main__": gif = "dotgreen.gif" app = qapplication(sys.argv) player = imageplayer(gif, "was") player.show() sys.exit(app.exec_())
actually gif saved before looping option play once. changing "forever" did trick.
Comments
Post a Comment