class MyQLabel(QtWidgets.QLabel): # 自定义信号, 注意信号必须为类属性 clicked = QtCore.pyqtSignal() def __init__(self, parent=None): super(MyQLabel, self).__init__(parent) def mouseReleaseEvent(self, QMouseEvent): self.clicked.emit() # 可在外部与槽函数连接 def connect_customized_slot(self, func): self.clicked.connect(func)
标签:__,clicked,自定义,Python,self,connect,def From: https://www.cnblogs.com/dlutccj/p/17012267.html