#autogui库的使用制作简易连点器
python 连点器的制作
连点器代码及exe程序:
1.autogui库的使用
(1)pyautogui.moveTo(x,y,duration=)#在duration的时间内将鼠标移动到指定位置 (2)pyautogui.moveRel(x,y,duration=)#在duration时间内将鼠标右移x,下移y(负数为左移) (3)pyautogui.position()#获取鼠标位置 (4)pyautogui.click(500,500,button = ‘right’)#在指定位置点击鼠标,默认为左键,button=‘left/right/middle’ (5)pyautogui.mouseUp()#按下鼠标 (6)pyautogui.mouseDown()#松开鼠标 (7)pyautogui.doubleClick()#双击鼠标左键 (8)pyautogui.rightClick()#双击鼠标右键 (9)pyautogui.middleClick()#双击鼠标中键
2.python qt响应键盘事件
class Test(QWidget): | |
def \_\_init\_\_(self): | |
super(Test, self).\_\_init\_\_() # 这里要这么写,我也不知道为什么 | |
self.initUI() | |
self.set\_connect() | |
def set\_connect(self): | |
self.button.clicked.connect(self.clickls) | |
def initUI(self): | |
#设置ui界面的建立 | |
self.setGeometry(300, 300, 350, 300) | |
self.setWindowTitle("连点器--by tansty") | |
self.labelx=QLabel(self) | |
self.labelx.resize(150,50) | |
self.labelx.setText("x轴的坐标") | |
self.labelx.move(20,0) | |
self.labely=QLabel(self) | |
self.labely.resize(150, 50) | |
self.labely.setText("y轴的坐标") | |
self.labely.move(20, 60) | |
self.textx=QLineEdit(self) | |
self.textx.resize(150,50) | |
self.textx.move(150,0) | |
self.texty=QLineEdit(self) | |
self.texty.resize(150,50) | |
self.texty.move(150,60) | |
self.button=QPushButton(self) | |
self.button.setText("开始连点") | |
self.button.resize(150,50) | |
self.button.move(180,200) | |
self.text2=QLineEdit(self) | |
self.text2.resize(150,50) | |
self.text2.move(150,120) | |
self.labelz=QLabel(self) | |
self.labelz.resize(150, 50) | |
self.labelz.setText("点击的次数:") | |
self.labelz.move(20, 120) | |
self.show() | |
def keyPressEvent(self, e): | |
if e.key() == Qt.Key\_F2: //按下F2响应事件 | |
self.get\_mouse() |
正文完