有没有办法使用 Python 将窗口移动到另一个监视器? [英] Is there a way to move a window to another monitor using Python?
本文介绍了有没有办法使用 Python 将窗口移动到另一个监视器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要获得一个窗口的句柄,然后将它移动到我的辅助显示器上.这是否适用于 python 2.6,最好使用标准库.
I need to get a handle to a Window and then move it to my secondary monitor. Is this doable with python 2.6, preferably using the standard libraries.
推荐答案
使用 pywin32 模块访问原生 Win32 API.您需要使用的功能是:
Use the pywin32 module to access the native Win32 API. The functions you'll need to use are:
EnumWindows
枚举系统中的所有顶级窗口;搜索您想要的并保存窗口句柄EnumDisplayMonitors
枚举系统中的所有监视器GetMonitorInfo
获取显示器的虚拟显示坐标并确定每个显示器是否为主显示器MoveWindow
使用您之前找到的窗口句柄将窗口移动到所需的虚拟显示坐标
这篇关于有没有办法使用 Python 将窗口移动到另一个监视器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文