PyQt5 鼠标事件
作者:互联网
################################ # PyQt5中文网 - PyQt5全套视频教程 # # https://www.PyQt5.cn/ # # 主讲: 村长 # ################################ from PyQt5.Qt import * import sys class Window(QWidget): def __init__(self): super().__init__() self.setWindowTitle("鼠标事件") self.resize(600, 500) self.func_list() # 鼠标事件 def mouseMoveEvent(self, QMouseEvent): print('鼠标跟踪',QMouseEvent.localPos()) def mousePressEvent(self,QMouseEvent): print('鼠标按下') def mouseReleaseEvent(self, QShowEvent): print('鼠标松开') def mouseDoubleClickEvent(self, QShowEvent): print('鼠标双击') def func_list(self): self.func() def func(self): pass if __name__ == '__main__': app = QApplication(sys.argv) window = Window() # window.setMouseTracking(True) window.show() sys.exit(app.exec_())
标签:__,鼠标,self,PyQt5,事件,print,def 来源: https://www.cnblogs.com/lvdongjie/p/16331129.html