标签:blog http io os ar for 2014 art c
import sys
from PyQt4.QtGui import QApplication , QGraphicsEllipseItem , QGraphicsItemAnimation
from PyQt4.QtGui import QGraphicsScene , QGraphicsView
from PyQt4.QtCore import SIGNAL , QPointF , QTimeLine
app = QApplication( sys.argv )
# create a graphicsview with a moving ball...
ball = QGraphicsEllipseItem(0, 0, 20, 20)
timer = QTimeLine(5000)
timer.setFrameRange(0, 100)#帧计数器开始startFrame,结束
animation = QGraphicsItemAnimation()#提供了简单的动画支持
animation.setItem(ball)
animation.setTimeLine(timer)
for i in xrange( 200 ) :
animation.setPosAt(i / 200.0, QPointF(i, i))
scene = QGraphicsScene()
scene.setSceneRect(0, 0, 250, 250)
scene.addItem(ball)
view = QGraphicsView(scene)
view.show()
timer.start()
app.exec_()
如图:
链接:http://comments.gmane.org/gmane.comp.python.pyqt-pykde/15315
标签:blog http io os ar for 2014 art c
原文地址:http://www.cnblogs.com/mhxy13867806343/p/4009402.html