I want to open VM player application through python code and I have to import/open VM file but whenever I tried opening the application through subprocess.Popen(self.vmware_path) python code line, it invokes the application at random x,y position.
I have researched some of the possibilities in the subprocess.Popen (STARTUPINOF) but I'm not able to understand the concept of STARTUPINFO class. os.system by this, I could open the application but not able to do it with the predefined position.
# print pyautogui.position()
# print pyautogui.size() # current screen resolution width and height
# pyautogui.PAUSE = 1
# pyautogui.FAILSAFE = True
subprocess.Popen(self.vmware_path)
# si = subprocess.STARTUPINFO()
# si.dwFlags = subprocess.STARTF_USESHOWWINDOW
# si.wShowWindow = 3
Here what I need is,
From pyautogui module, not possible to start the application directly.But you can use the os module to launch the application.
Sample:
import os
os.system('start "" "' + path+ '"')
note: path of the application with name
it will launch the application and maximize the screen, then you can use pyautogui to get the screen data(size, position etc).
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.