我想通过Python代码打开VM Player应用程序,我必须导入/打开VM文件,但是每当我尝试通过subprocess.popen.popen.popen(self.vmware_path)python code Line打开应用程序时,它在随机x,y位置调用应用程序。
我已经研究了subprocess.popen(startupinof)中的一些可能性,但我无法理解启动企业类的概念。os.System,我可以打开应用程序,但无法使用预定义的位置进行操作。
# 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
我需要的是
- 我必须通过Pyautogui或任何其他Python模块以及以下支持打开VM Player应用程序。
- 它应该接受预定义的窗口大小 或
- 它应该最大化应用程序到实际监视器大小。
来自Pyautogui模块,无法直接启动应用程序。但是您可以使用OS模块启动应用程序。
样本:
import os
os.system('start "" "' + path+ '"')
注意:使用名称的路径
它将启动应用程序并最大化屏幕,然后您可以使用pyautogui获取屏幕数据(大小,位置等)。