如何在 PyQt5 中制作动画?

How to make a animation in PyQt5?

我正在尝试制作动画,但在 运行 时出现错误。

self.__animation = QPropertyAnimation(self, "geometry")

并提出这个问题:/有人知道如何解决吗?

    self.__animation = QPropertyAnimation(self, "geometry")
TypeError: arguments did not match any overloaded call:
  QPropertyAnimation(parent: QObject = None): too many arguments
  QPropertyAnimation(QObject, Union[QByteArray, bytes, bytearray], parent: QObject = None): argument 2 has unexpected type 'str'

您必须使用 bytearray,而不是 str:

self.__animation = QPropertyAnimation(self, b'geometry')