pyvista.Plotter.window_size_context#

Plotter.window_size_context(window_size=None)[source]#

Set the render window size in an isolated context.

Parameters:
window_sizesequence[int], optional

Window size in pixels. Defaults to pyvista.Plotter.window_size.

Examples

Take two different screenshots with two different window sizes.

>>> import pyvista as pv
>>> pl = pv.Plotter(off_screen=True)
>>> _ = pl.add_mesh(pv.Cube())
>>> with pl.window_size_context((400, 400)):
...     pl.screenshot('/tmp/small_screenshot.png')  
...
>>> with pl.window_size_context((1000, 1000)):
...     pl.screenshot('/tmp/big_screenshot.png')  
...