Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

remot mouce use python

class Client:
    def __init__(self):
        self.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.port = 3000
        self.connection = False

    def connect(self, server_ip):
        request = bytes("Request","utf-8")
        self.s.sendto(request, (server_ip, self.port))
        received, address = self.s.recvfrom(4096)
        if received == request:
            print("Connected to {}".format(server_ip))
            self.connection = True
            threading.Thread(target=self.receive_data).start()

    def receive_data(self):
        while self.connection:
            data, server = self.s.recvfrom(4096)
            pos = pickle.loads(data)
            self.control_mouse(pos)

    def disconnect(self):
        print("Disconnected from the server")
        self.connection = False

    def control_mouse(self, position):
        pyautogui.moveTo(position[0], position[1])

    def close(self):
        self.disconnect()
        self.s.close()
Comment

PREVIOUS NEXT
Code Example
Python :: percent change pandas using log 
Python :: difference() Function of sets in python 
Python :: How To Remove Elements From a Set using discard() function in python 
Python :: python linkedhashmap 
Python :: how to track exact location of a phone number in python 
Python :: python datetime toordinal 
Python :: how list ul info with python 
Python :: how to install apps in django 
Python :: relative ranks in python 
Python :: python async await function await expression 
Python :: How to convert string to uppercase, lowercase and how to swapcase in python 
Python :: comparison operators in python 
Python :: metros para cm para mm 
Python :: 3x4 matrix 
Python :: mql5 python 
Python :: 10 minutes to pandas 
Python :: generate natural numbers python 
Python :: python iterate through lists 
Python :: if else ifadesi 
Python :: check if variable is iterable python 
Python :: transform jpg image into array for conv2d 
Python :: python array_combine 
Python :: how to write statements in python 
Python :: add python 3.9 to usr/bin 
Python :: pip unknown command import 
Python :: numpy index array all except 
Python :: python import cache (testing grepper, maybe not a helpful solution) 
Python :: python type conversion 
Python :: raspberry pi pwm controlled leds 
Python :: does xgboost accept pandas 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =