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()
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/103015.html
標籤:其他
上一篇:【題解】LuoGu5201:[USACO19JAN]Shortcut G
下一篇:JS基礎知識(變數、資料型別)
