Пример #1
0
    def Position(self):
        location = Execute(["xdotool", "getmouselocation", "--shell"])
        lines = location.split("\n")
        x, y, window = lines[0], lines[1], lines[3]

        x = x.replace("X=", "")
        y = y.replace("Y=", "")
        window = window.replace("WINDOW=", "")

        return (int(x), int(y), window)
Пример #2
0
    def DragTo(self, FromX, FromY, ToX, ToY):
        current_x, current_y, _ = self.Position()

        Execute(
            [
                "xdotool",
                "mousemove",
                "--window",
                self.Window,
                str(FromX),
                str(FromY),
                "mousedown",
                "--window",
                self.Window,
                "1",
                "mousemove",
                "--window",
                self.Window,
                str(ToX),
                str(ToY),
                "mouseup",
                "--window",
                self.Window,
                "1",
                "mousemove",
                str(current_x),
                str(current_y),
            ]
        )
Пример #3
0
    def Click(self, X, Y, click_type=1):
        current_x, current_y, _ = self.Position()

        Execute(
            [
                "xdotool",
                "mousemove",
                "--window",
                self.Window,
                str(X),
                str(Y),
                "click",
                "--window",
                self.Window,
                str(click_type),
                "mousemove",
                str(current_x),
                str(current_y),
            ]
        )
Пример #4
0
        def __init__(self, FileName="images/tmp_screen.png"):
            Execute(["scrot", "-u", FileName])
            self.TakedImage = cv2.imread(FileName)

            if self.TakedImage is not None:
                self.result = 1
Пример #5
0
 def KeyUp(self, key):
     Execute(["xdotool", "keyup", key])
Пример #6
0
 def KeyDown(self, key):
     Execute(["xdotool", "keydown", key])
Пример #7
0
 def Press(self, key):
     Execute(["xdotool", "key", "--window", self.Window, key])
Пример #8
0
 def MoveMouse(self, X, Y):
     Execute(
         ["xdotool", "mousemove", "--window", self.Window, str(X), str(Y), ]
     )