Issue
def make_frame(self):
label_name = QLabel(self)
label_name.setGeometry(20, 630, 40, 30)
label_name.setStyleSheet("background-color: rgb(233, 94, 25); ""border : 2px solid black; ")
label_name.setAlignment(Qt.AlignCenter)
label_name.show()
return label_name
def animation(self):
self.label = self.make_frame()
self.anim = QPropertyAnimation(self.label, b"geometry", parent=self, duration=3000)
self.anim.setEndValue(QRect(120, 630, 40, 30))
self.anim.start()
Solution
A possible solution is to use the finished signal of the animation to call the deleteLater() method.
def animation(self):
label = self.make_frame()
anim = QPropertyAnimation(label, b"geometry", parent=self, duration=3000)
anim.setEndValue(QRect(120, 630, 40, 30))
anim.finished.connect(label.deleteLater)
anim.start()
Answered By - eyllanesc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.