3.5 Multiple viewports

Drawing in pyFormex is not limited to a single canvas. You can create any number of canvas widgets laid out in an array with given number of rows or columns. The following functions are available for manipulating the viewports.

layout( nvps=None,ncols=None,nrows=None)
Set the viewports layout. You can specify the number of viewports and the number of columns or rows.

If a number of viewports is given, viewports will be added or removed to match the number requested. By default they are layed out rowwise over two columns.

If ncols is an int, viewports are laid out rowwise over ncols columns and nrows is ignored. If ncols is None and nrows is an int, viewports are laid out columnwise over nrows rows.

addViewport( )
Add a new viewport.

removeViewport( )
Remove the last viewport.

linkViewport( vp,tovp)
Link viewport vp to viewport tovp.

Both vp and tovp should be numbers of viewports. The viewport vp will now show the same contents as the viewport tovp.

viewport( n)
Select the current viewport. All drawing related functions will henceforth operate on that viewport.

This action is also implicitly called by clicking with the mouse inside a viewport.