【发布时间】:2013-12-06 18:19:58
【问题描述】:
我正在尝试在启动时为窗口设置动画,但它似乎不起作用,我已经编写了下面的代码。
from PyQt4 import QtCore,QtGui
import sys
class AnimatedWindow(QtGui.QMainWindow):
"""docstring for AnimatedWindow"""
def __init__(self):
super(AnimatedWindow, self).__init__()
animation = QtCore.QPropertyAnimation(self, "geometry")
animation.setDuration(10000);
animation.setStartValue(QtCore.QRect(0, 0, 100, 30));
animation.setEndValue(QtCore.QRect(250, 250, 100, 30));
animation.start();
if __name__ == "__main__":
application = QtGui.QApplication(sys.argv)
main = AnimatedWindow()
main.show()
sys.exit(application.exec_())
【问题讨论】:
-
QPropertyAnimation类在Qt 4.6及以上版本中支持,您使用的是什么版本?