

def getcoordinatesatpixel(self, pixelx, pixely=None, onscreen=True):
    "\n        Given the pixel x and y coordinates relative to the PygCurse screen's origin, return the cell x and y coordinates that it is over. (Useful for finding what cell the mouse cursor is over.)\n\n        Returns (None, None) if the pixel coordinates are not over the screen.\n        "
    if (type(pixelx) in (tuple, list)):
        if (type(pixely) == bool):
            onscreen = pixely
        (pixelx, pixely) = pixelx
    if ((onscreen and ((pixelx < 0) or (pixelx >= (self._width * self._cellwidth)))) or ((pixely < 0) or (pixely >= (self._height * self._cellheight)))):
        return (None, None)
    return (int((pixelx / self._cellwidth)), int((pixely / self._cellheight)))

dataset/ETHPy150Open asweigart/pygcurse/pygcurse/__init__.py PygcurseSurface.getcoordinatesatpixel/original