簡體   English   中英

如何通過 Python 調整活動 window 的大小

[英]How to resize active window through Python

I want to write a python script that will increase the width of the Windows window that's currently active (whether that's cmd.exe, or an IDE, just whatever Window is active). 我們怎樣才能做到這一點?

您可以使用“win32gui”庫獲取當前的 window,然后調整其大小。 就是這樣 -

import win32gui
current = win32gui.GetForegroundWindow()
win32gui.MoveWindow(current, 0, 0, 1000, 700, True)

這將“獲取”當前 window,將其移動到指定的 position (0,0),然后將其調整為指定的值 (1000,700)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM