def resizeDialog(self):
self.animation = QtCore.QPropertyAnimation(self, "size")
# self.animation.setDuration(1000) #Default 250ms
if self.size().width()==200:
self.animation.setEndValue(QtCore.QSize(600,300))
else:
self.animation.setEndValue(QtCore.QSize(200,100))
self.animation.start()
The source linked by this question, leads to this code. Translating from the c++ code to python is fairly straight forward in this case.