python 3.4 - Running Pyautogui on a different computer with different resolution -


i have python script runs on work computer (1600 x 900 resolution). on computer took screenshot images used pyautogui.locateonscreen. tried run program on home laptop different resolution (1340 x 640) , script not seem find image location. guessing because of different resolution. (i have copied script folder work computer home computer, path image file same). there can change in script pyautogui.locateonscreen identify image on computer resolution?

i think you'll need take screenshot of image on different resolution, , @ start of program have detect whether it's on 1600x900 screen or 1340x640 screen. make 'locateonscreen' pieces take variable, , depending on screen size, replace variables path correct image.

import pyautogui  def function():     pyautogui.locateonscreen(x)     ...     pyautogui.locateonscreen(y)     ...  screen = pyautogui.size() if screen = (1600, 900):     x = 'image1_1600_900.png'     y = 'image2_1600_900.png' else:     x = 'image1_1340_640.png'     y = 'image2_1340_640.png'  function() 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -