[PyQt] PyQt5 bug in QPropertyAnimation on Windows

Phil Thompson phil at riverbankcomputing.com
Fri Jul 31 23:20:35 BST 2015


On 31/07/2015 10:35 pm, Trilarion wrote:
> Hi,
> 
> I have a problem of PyQt5 not recognizing the second parameter of the
> constructor of QPropertyAnimation as string on Python 3 and Windows.
> It should be a bug.
> 
> Example code:
> 
> from PyQt5.QtWidgets import QProgressBar, QApplication
> from PyQt5.QtCore import QPropertyAnimation
> 
> app = QApplication([])
> 
> pbar = QProgressBar()
> pbar.show()
> 
> animation = QPropertyAnimation(pbar, "value")
> animation.start()
> 
> app.exec_()
> 
> Error:
> 
> line 9, in <module>
> animation = QPropertyAnimation(pbar, "value")
> TypeError: arguments did not match any overloaded call:
> QPropertyAnimation(QObject parent=None): too many arguments
> QPropertyAnimation(QObject, QByteArray, QObject parent=None): argument
> 2 has unexpected type 'str'
> 
> System:
> 
> Python 3.4.2 64 bit on Windows 7 64 bit
> + PyQt5-5.5-gpl-Py3.4-Qt5.5.0-x64.exe (downloaded on 07-26-2015)

It's not a bug. As of PyQt v5.5 (and deprecated in v5.4) Python strings 
do not get automatically converted to a QByteArray because the codec is 
not known. Pass a bytes object instead of a string.

Phil


More information about the PyQt mailing list