1

I am using VPython to visualize some data from a computer simulation. I want to make a movie out of the VPython output. Therefore I tried to make screenshots from the vpython output window. I want to capture the output window in fullscreen mode. This way i don't need to crop the window frame. I tried ImageGrab.grab() (see here) and win32gui (see here), but both methods capture the desktop instead of the fullscreen window.

Methods screenshot and _get_windows_bytitle from here

windowtitle = 'sometitlename'
newscene = display(fullscreen=True,title=windowtitle)
newscene.cursor.visible=false
newscene.select()

b = box()
rate(1)
screenshot(_get_windows_bytitle(windowtitle)[0])

Same problem with ImageGrab.grab. Any suggestions?

4

1 回答 1

1

我找不到任何解决方案,所以我通过手动裁剪窗口来使用解决方法。

disp = display(width=1000, height=1040)
displayrect = (int(round(disp.x))+8, int(round(disp.y))+30, int(round(disp.width))-16, int(round(disp.height))-38)
ImageGrab.grab(displayrect)

我对此并不满意,因为对窗口边框宽度/高度进行硬编码非常麻烦(我不会为此使用 win32 模块)

于 2013-10-27T18:31:30.570 回答