(5)获取鼠标点击时的坐标:
1def mousePressEvent(self, event):
2 if event.buttons() & QtCore.Qt.LeftButton:
3 x = event.x() -120
4 y = event.y() -10
5 text = "x: {0},y: {1}".format(x,y)
6 if x>= 0 and y>= 0:
7 m.position = (x, y)
8 time.sleep( 0.1)
9 m.click(Button.left, 1)
10 print( text)
(6)按钮绑定所设置的函数:
1 def slot_init( self):
2 self .button_open_camera.clicked.connect( self .button_open_camera_click)
3 self .timer_camera.timeout.connect( self .show_camera)
4 self .button_close.clicked.connect( self .close)
(7)显示桌面功能函数,并设置点击时修改名称,可以随时关闭桌面
1 def button_open_camera_click(self):
2 if self.timer_camera.isActive() == False:
3 self.timer_camera.start( 30)
4 self.button_open_camera.setText( u'关闭')
5