I'm doing an animation of a simple frame, but I want the animation to start when the cursor is on the frame and return to its initial shape when it leaves the frame.
Since at the moment it only works with one button, this is my code
import sys
from PyQt5.QtWidgets import QMainWindow,QApplication,QPushButton,QFrame
from PyQt5.QtCore import QRect, QPropertyAnimation
from PyQt5 import uic
class Principal(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.boton = QPushButton("animacion",self)
self.boton.clicked.connect(self.anima)
self.frame = QFrame(self)
self.frame.setFrameStyle(QFrame.Panel | QFrame.Raised)
self.frame.setGeometry(100,100,30,50)
def bot(self):
print("click")
def anima(self):
self.anim = QPropertyAnimation(self.frame,b"geometry")
self.anim.setDuration(100)
self.anim.setStartValue(QRect(100,100,30,50))
self.anim.setEndValue(QRect(100,100,90,50))
self.anim.start()
app = QApplication([])
p = Principal()
p.resize(300,300)
p.show()
app.exec_()
and they could explain to me b "geometry" that other values can be placed instead of this in the animation