コード例 #1
0
    def get_pixel_color(x: int, y: int, debug: bool = False) -> str:
        """Get the color of selected pixel in HEX."""
        dc = win32gui.GetWindowDC(Window.id)
        x, y = Window.coord_manager(x, y)
        rgba = win32gui.GetPixel(dc, x, y)
        win32gui.ReleaseDC(Window.id, dc)
        r = rgba & 0xff
        g = rgba >> 8 & 0xff
        b = rgba >> 16 & 0xff

        if debug:
            print(Inputs.rgb_to_hex((r, g, b)))

        return Inputs.rgb_to_hex((r, g, b))
コード例 #2
0
ファイル: com.py プロジェクト: Kerulis/NGU-scripts
 def set_cur_pos(x: int, y: int) -> None:
     """Fake position returned by user32.GetCursorPos"""
     """hook_get_cur_pos needed"""
     x, y = Window.coord_manager(x, y)
     Com.pipe.write(struct.pack('<bhh', 0x0, x, y))
     Com.sync()