Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the Connector with Python

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to achieve the Python connector, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Ah, for this reason, I have specially prepared two programs, one for testing and the other for the main program. Come and see

# improved version import pyautogui as pagfrom time import sleep,timepag.PAUSE = 0def mouse (): B = input ('how many clicks do you need?') B = int (b) c = input ('do you need a left or right button when you click? \ nPlease enter 0 on the left button, and right-enter 1') c = int (c) print ('Please note: you need to move the mouse to the point where you need to connect within 8 seconds, then don't move, wait for the quick connection to begin.') Sleep (8) print ('start clicking!') XMagi y = pag.position () d = 'left' if c: d =' right' e = time () for i in range (0rem b): pag.click (XMagne yButton = d) f = time ()-e input ('finished. It took% f seconds.' % f) def key (): print ('Please select the keys you need from the supported keys below.') For i in pag.KEYBOARD_KEYS: print (ringing% s'% iRegent endgame') b = input ('\ nPlease enter the characters you need to type quickly:') if b in pag.KEYBOARD_KEYS: C = input ('Please enter how many times you need to enter:') c = int (c) print ('Please note that you need to switch to the window you need to enter within 8 seconds.') Sleep (8) print ('get to work!') E = time () for i in range (0rem c): pag.press (b) f = time ()-e input ('complete. It took% f seconds.' % f) else: input ('the character you entered is not a supported character, please modify it.') Try: a = input ('enter the service you need (number):\ N1: quick connection point\ N2: quick input\ n >') a = int (a) if a = = 1: mouse () elif a = = 2: key () else: input ('Sorry, I can't find the service you need. \ n') except Exception as e: print ('error;\ nbadgery e)

Test program:

Import pygamefrom pygame.locals import * from pygame.color import THECOLORSpygame.init () canvas = pygame.display.set_mode ((600600)) canvas.fill ((255255255)) pygame.display.set_caption ('TEST') # mouse clicks mouBut = number of times the space bar is pressed keyDow = 0def handle (): global mouBut KeyDow for event in pygame.event.get (): if event.type = = QUIT: pygame.quit () exit () # when the mouse is pressed if event.type = = MOUSEBUTTONDOWN: XCoI y = event.pos # and if 200in the black rectangle

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report