简体   繁体   中英

how do i use Pyautogui locate on screen function within only one application window instead of the whole screen

I'm trying to find a way to make my automation bot faster I realized that by searching only within the application window instead of the whole screen would give it a speed post how can i do it

You need to give us some code or what you already tried.

But you could use pywinauto package to use the application you want. For more details please check the How does it work .

You can get all applications open from Desktop function as:

from pywinauto import Desktop

windows = Desktop(backend="uia").windows()
window = [w.window_text() for w in windows]

So if you print(window) you will have for example:

['Zoom', ''python - how do i use Pyautogui locate on screen function within only one application window instead of the whole screen - Stack Overflow', 'Dictations - OneNote']

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM