

def displayMousePosition(xOffset=0, yOffset=0):
    'This function is meant to be run from the command line. It will\n    automatically display the location and RGB of the mouse cursor.'
    print('Press Ctrl-C to quit.')
    if ((xOffset != 0) or (yOffset != 0)):
        print(('xOffset: %s yOffset: %s' % (xOffset, yOffset)))
    resolution = size()
    try:
        while True:
            (x, y) = position()
            positionStr = ((('X: ' + str((x - xOffset)).rjust(4)) + ' Y: ') + str((y - yOffset)).rjust(4))
            if (((x - xOffset) < 0) or ((y - yOffset) < 0) or ((x - xOffset) >= resolution[0]) or ((y - yOffset) >= positionStr[1])):
                pixelColor = ('NaN', 'NaN', 'NaN')
            else:
                pixelColor = pyscreeze.screenshot().getpixel((x, y))
            positionStr += (' RGB: (' + str(pixelColor[0]).rjust(3))
            positionStr += (', ' + str(pixelColor[1]).rjust(3))
            positionStr += ((', ' + str(pixelColor[2]).rjust(3)) + ')')
            sys.stdout.write(positionStr)
            sys.stdout.write(('\x08' * len(positionStr)))
            sys.stdout.flush()
    except KeyboardInterrupt:
        sys.stdout.write('\n')
        sys.stdout.flush()

dataset/ETHPy150Open asweigart/pyautogui/pyautogui/__init__.py displayMousePosition/VarMisuse@161/263 `resolution`->`positionStr`