Skip to content

Commit

Permalink
Merge pull request #850 from Arrendy/add-mouse-position
Browse files Browse the repository at this point in the history
implement mouse position function
  • Loading branch information
KillianLucas authored Dec 24, 2023
2 parents 69b5fb2 + 75215fc commit cb0023c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion interpreter/core/computer/mouse/mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@
import matplotlib.pyplot as plt
import numpy as np
import pyautogui
from PIL import Image


class Mouse:
def __init__(self, computer):
self.computer = computer

def position(self):
"""
Get the current mouse position.
Returns:
tuple: A tuple (x, y) representing the mouse's current position on the screen.
"""
try:
return pyautogui.position()
except Exception as e:
raise RuntimeError(
f"An error occurred while retrieving the mouse position: {e}. "
)

def move(self, *args, x=None, y=None, icon=None):
screenshot = None
if len(args) > 1:
Expand Down

0 comments on commit cb0023c

Please sign in to comment.