本文整理汇总了Python中PyQt4.QtCore.QPropertyAnimation.setLoopCount方法的典型用法代码示例。如果您正苦于以下问题:Python QPropertyAnimation.setLoopCount方法的具体用法?Python QPropertyAnimation.setLoopCount怎么用?Python QPropertyAnimation.setLoopCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation.setLoopCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from PyQt4.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt4.QtCore.QPropertyAnimation import setLoopCount [as 别名]
class test(QDialog):
def __init__(self,parent=None):
super(test,self).__init__(parent)
self.pushbutton = MyButton('Popup Button')
# self.pushbutton.setAutoFillBackground(False)
self.pushbutton.move(0, 50)
# self._alpha = 255
# self.pushbutton.setStyle('plastique')
# self.animation = QPropertyAnimation(self.pushbutton, "geometry")
# self.animation.setDuration(1000)
# self.animation.setKeyValueAt(0, QRect(100, 100, 50, 30));
# self.animation.setKeyValueAt(0.8, QRect(150, 150, 50, 30));
# self.animation.setKeyValueAt(1, QRect(100, 100, 50, 30));
self.animation = QPropertyAnimation(self.pushbutton, "alpha")
self.animation.setDuration(1000)
# self.animation.setStartValue(20)
# self.animation.setEndValue(255)
self.animation.setKeyValueAt(0, 10)
self.animation.setKeyValueAt(0.5, 200)
self.animation.setKeyValueAt(1, 255)
self.animation.setLoopCount(5)
self.animation.start()
# print(self.pushbutton)
layout = QVBoxLayout()
layout.addWidget(self.pushbutton)
# layout.addLayout(btnlayout2)
# layout.addLayout(bottomlayout2)
self.setLayout(layout)
self.setGeometry(100, 100, 200, 200)
# menu = QtGui.QMenu()
# menu.addAction('This is Action 1', self.Action1)
# menu.addAction('This is Action 2', self.Action2)
# pushbutton.setMenu(menu)
# self.setCentralWidget(pushbutton)
def Action1(self):
print('You selected Action 1')
def Action2(self):
print('You selected Action 2')
示例2: groupAnimation
# 需要导入模块: from PyQt4.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt4.QtCore.QPropertyAnimation import setLoopCount [as 别名]
def groupAnimation(ws, btngroup):
# 建立一个平行的动作组
ag = QParallelAnimationGroup()
for w in ws:
tmpbtn = btngroup.button(int(w[0]))
# 对于每个按钮, 都生成一个进入的动作
a = QPropertyAnimation(tmpbtn, "alpha")
a.setDuration(200)
a.setKeyValueAt(0, 10)
# a.setKeyValueAt(0.5, 200)
a.setKeyValueAt(1, 255)
a.setLoopCount(-1)
a.setEasingCurve(QEasingCurve.OutQuad)
# a.setStartValue(QRect(-100, w.y(), w.width(), w.height()))
# a.setEndValue(w.geometry())
# 添加到组里面去
ag.addAnimation(a)
return ag