如果你要像我一樣使用POPEN子方法,你將需要刪除p.wait(),因爲它會等待視頻運行了代碼(它把過程在之前結束隊列而不是線程)。
與馬蒂諾的幫助下,他提供我用下面(安裝pywin32爲Python 3.5之後)答案:
import pywintypes
import win32gui
displays = [[-10,0,980,530],
[954,0,980,530],
[-10,515,980,530],
[954,515,980,530]] #these are the x1,y1,x2,y2 to corner all 4 videos on my res (1920x1080)
def enumHandler(hwnd, lParam):
if win32gui.IsWindowVisible(hwnd):
print(win32gui.GetWindowText(hwnd)) #this will print all the processes title
if name in win32gui.GetWindowText(hwnd): #it checks if the process I'm looking for is running
win32gui.MoveWindow(hwnd,i0,i1,i2,i3,True) #resizes and moves the process
win32gui.EnumWindows(enumHandler, None) #this is how to run enumHandler
的X1,Y1,X2,Y2可能是您的流程不同,但這些工作對vlc媒體播放器來說很好。我希望我很清楚,但如果你沒有完成,你應該檢查馬提諾提供的答案。
[這個答案](http://stackoverflow.com/a/14654287/355230)到一個不相關的問題顯示如何使用'win32gui.MoveWindow()'在Windows桌面上定位窗口(以及如何遍歷所有可見的)。類似的東西就是你需要做的。 – martineau
謝謝!它解決了我的問題。 –
你很受歡迎。 ':-)'當你被允許(經過一段時間後),你可以發佈一個答案給你自己的問題,這可以幫助其他人解決類似的問題。 – martineau