first commit
This commit is contained in:
25
detector.py
Normal file
25
detector.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import pyautogui
|
||||
import keyboard
|
||||
import time
|
||||
|
||||
print("Listo. Pulsa 'P' para imprimir posición y color. Ctrl+C para salir.")
|
||||
|
||||
def obtener_pixel_mouse():
|
||||
# Posición actual del ratón
|
||||
x, y = pyautogui.position()
|
||||
|
||||
# Captura solo 1x1 px (eficiente)
|
||||
img = pyautogui.screenshot(region=(x, y, 1, 1))
|
||||
color = img.getpixel((0, 0))
|
||||
|
||||
print(f"Posición: ({x}, {y}) | Color RGB: {color}")
|
||||
|
||||
|
||||
while True:
|
||||
if keyboard.is_pressed("p"):
|
||||
obtener_pixel_mouse()
|
||||
|
||||
# Anti-rebote para no spamear mientras mantienes la tecla
|
||||
time.sleep(0.3)
|
||||
|
||||
time.sleep(0.05)
|
||||
Reference in New Issue
Block a user