Search code examples
pythonpyqt6

How does one find the PyQt6 version of PyQt5 class QAbstractTransition


I'm trying to convert this PyQt5 example to PyQt6 but it has some modules that are not available through QtCore. I've been taking a PyQt6 class and working through examples but I'm not yet at the point where I can understand the documentation very well. I found qrand and qsrand in QObject. How can I find how or where to import QAbstractTransition? Could this be something that is not yet implemented in PyQt6?

"""https://github.com/baoboa/pyqt5/blob/master/examples/animation/moveblocks.py"""
"""
from PyQt5.QtCore import (QAbstractTransition, QEasingCurve, QEvent,
        QParallelAnimationGroup, QPropertyAnimation, qrand, QRect,
        QSequentialAnimationGroup, qsrand, QState, QStateMachine, Qt, QTime,
        QTimer)
"""
from PyQt6.QtCore import (QEasingCurve, QEvent,
        QParallelAnimationGroup, QPropertyAnimation, QRect,
        QSequentialAnimationGroup, Qt, QTime, QTimer)
# from PyQt6.   can't find QAbstractTransition
from PyQt6.QtCore import QObject

Solution

  • QAbstractTransition has been moved to the new module called QtStateMachine so ideally you should import it using from PyQt6.QtStateMachine import QAbstractTransition. Unfortunately PyQt6 hasn't implemented it (maybe it's a bug), PySide6 has instead.