我正在使用PyQt5构建一个带有多个按钮的应用程序。 我要完成的是为我的一些按钮创建一个闪烁的背景色(黄红色)。
btn1.setStyleSheet("background-color: green; color: red; font-weight: 800; font-size: 22")
tobyte = 'styleSheet'
a = bytearray(tobyte, 'utf-8')
animation = QtCore.QPropertyAnimation(' + 'btn' + str(yy) + ', a)
animation.setDuration(1000)
animation.setLoopCount(1000)
animation.setStartValue("background-color: yellow; color: red; font-weight: 800; font-size: 22")
animation.setEndValue("background-color: red; color: red; font-weight: 800; font-size: 22")
animation.start()
动画开始(移除预定义的绿色背景),但不会将按钮的背景颜色更改为黄色或红色。
有什么想法吗?
目前没有回答
相关问题 更多 >
编程相关推荐