With this container you can easily animate any widget even within QtDesigner. It animates the maximumWidth and minimumWidth properties and you can use the setAnimFrom and setAnimTo slots to set these.
You can use the provided signals to do other things in therms of animation.
The setExpanded method can be used to trigger the animation and the setAnimateOnHover to trigger animations when the container is hovered with the mouse.
importsysfromPySide6.QtCoreimport*fromPySide6.QtGuiimport*fromPySide6.QtWidgetsimport*fromMadQt.WidgetsimportExpander# Construct application
app=QApplication(sys.argv)# Create QWidget
window=QWidget()window.setMinimumWidth(260)# Create layout
QHBoxLayout(window)# Create a label
label=QLabel(' Hello ')label.setStyleSheet("background-color:gray;")# Construct an Expander widget
expander=Expander()# Setting properties
expander.curve=QEasingCurve.OutCubicexpander.duration=300# Set stylesheet
expander.setStyleSheet("background-color:gray;")# Set Expander layout
QVBoxLayout(expander)expander.layout().setContentsMargins(0,0,0,0)# Add widgets to main widget layout
expander.layout().addWidget(QLabel('Expandable'))window.layout().addWidget(label)window.layout().addWidget(expander)# Show and execute app
window.show()sys.exit(app.exec())