如何通过pyautogui模块在带有预定义window(x,y)位置的python中打开外部应用程序?

问题描述 投票:0回答:1

我想通过python代码打开VM Player应用程序,我必须导入/打开VM文件,但是每当我尝试通过subprocess.Popen(self.vmware_path)python代码行打开应用程序时,它都会在x,y处随机调用该应用程序位置。

我已经研究了子过程.Popen(STARTUPINOF)中的一些可能性,但是我无法理解STARTUPINFO类的概念。通过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

我需要的是,

  1. 我必须通过pyautogui或任何其他python模块以及以下支持来打开VM Player应用程序。
    • 它应该接受预定义的窗口大小或
    • 它应将应用程序最大化到实际的监视器大小。
python python-2.7 subprocess resolution pyautogui
1个回答
0
投票
无法从pyautogui模块直接启动应用程序。但是您可以使用os模块来启动应用程序。
© www.soinside.com 2019 - 2024. All rights reserved.