'use pyautogui in a certain open program in windows

I would like to use image search in a certain open application, for example, I want it to search the image only in the windows "Calculator" application, how could I do that?

Today pyautogui searches the whole screen, is it possible to limit only one open application?

def main():
    try:
        while True:
           button7location = pyautogui.locateOnScreen('images/calc7Key.png', region=(0,0,1920, 1080), confidence=.5)
           print(button7location)

    except KeyboardInterrupt:
        print('\nDone.')

main()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source