I did a toggle menu when I pressed the button it will expand(Increase the height) and shrink(Decrease the height). That is what I expected. It turns out that it fine for expanding the menu but not with shrinking.
I set QFrame with minimum: W 201 H 0 maximum: W 201 H 0
def toggleMenu(self,maxHeight,enable):
if enable :
#get height
height = self.ui.LeftMenu.height()
print(height)
maxExtend = maxHeight
standard = 0
#set height
if height == 0 :
heightExtended = maxExtend
else:
heightExtended = standard
# Animation
print(heightExtended)
self.animation = QPropertyAnimation(self.ui.LeftMenu, b"minimumHeight")
self.animation.setDuration(200)
self.animation.setStartValue(height)
self.animation.setEndValue(heightExtended)
self.animation.setEasingCurve(QEasingCurve.Type.InOutQuart)
self.animation.start()
Here what I got and it works!!! Hope it will help the other for similar problem ;-;