我做了一切[直到我知道]动画的背景色按钮,但我做不到。以下是我的一个尝试:
# I set the style of the button by setstylesheet()
animation = QPropertyAnimation(btn, "style",btn)
animation.setDuration(1000)
animation.setStartValue(QStyle("background-color:blue"))
animation.setEndValue(QStyle("background-color:red"))
animation.start()
但以下代码显示以下错误:
动画.setStartValue(QStyle(“背景-颜色:蓝色"))
类型错误:PyQt4。QtGui.QStyle型表示C++抽象类,不能实例化>/P> 我还试图设置一个调色板: 然后我在上面的动画值中写了 QPropertyAnimation:您正在尝试为QObject的不存在的属性样式设置动画QColor(r,g,b)
,而不是QStyle
,但这也没用,它说:
谢谢是特别的
C++,QT5,但可能在QT4
中起作用相关问题 更多 >
编程相关推荐