How Could I Wait Without Freezing Main Thread
I want to make a form rolling out from side, but it just teleports class SubWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = loadUi
Solution 1:
I understand that you want the widget to move smoothly, in that case the solution is to use QPropertyAnimation:
def UploadButtonClicked(self):
animation_group = QParallelAnimationGroup(self)
for w in (self.LoginText, self.UploadButton, self.PassText):
start_pos = w.pos()
end_pos = w.pos() + QPoint(0, -10)
animation = QPropertyAnimation(
self,
propertyName=b"pos",
targetObject=w,
startValue=start_pos,
endValue=end_pos,
duration=1000,
)
animation_group.addAnimation(animation)
animation_group.start(QParallelAnimationGroup.DeleteWhenStopped)
Post a Comment for "How Could I Wait Without Freezing Main Thread"