# VTK Examples - Changes to ViewportBorders

**URL:** https://discourse.vtk.org/t/vtk-examples-changes-to-viewportborders/16373
**Category:** Announcements
**Created:** [April 7, 2026, 7:27am UTC](https://discourse.vtk.org/t/vtk-examples-changes-to-viewportborders/16373 "2026-04-07T07:27:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [April 7, 2026, 7:27am UTC](https://discourse.vtk.org/t/vtk-examples-changes-to-viewportborders/16373/1 "2026-04-07T07:27:32Z")

</div>

Changes mainly focusing on viewport borders and using text widgets:

- The C++ snippet `ViewportBorder` has been renamed to [DrawViewportBorder](https://examples.vtk.org/site/Cxx/Snippets/DrawViewportBorder/). It now returns a `vtkActor2D`. Additionally a struct `ViewportBorderSpecifier` is provided to specify what lines need to be drawn around the border. This is particularly useful for drawing borders around multiple viewports without duplicating adjacent borders.
- The Python snippet [DrawViewportBorder](https://examples.vtk.org/site/PythonicAPI/Snippets/DrawViewportBorder/) has also been refactored to return a `vtkActor2D`. It also uses a a dataclass called `ViewportBorderSpecifier`.
- The C++ snippet [ReadPolyData](https://examples.vtk.org/site/Cxx/Snippets/ReadPolyData/) has been rewritten to use the C++ filesystem. Note the use of `.generic_string()` - really important for Windows! The thinking here is that the C++ `filesystem` is so natural and easy to use, much like Python’s `pathlib` so why not use it.

Of course, examples affected by these changes have been rewritten and … “improved”. Additionally, in the case of the C++ examples, where the viewports were labelled, these labels have been converted to vtkTextWidgets. The advantage of this is that the text widgets stay in the same relative position when the window is resized. To position multiple text widgets, a function is provided called `GetTextPositions(...)`, in C++, and `get_text_positions(...)`, in Python. There is a PythonicAPI snippet [GetTextPositions](https://examples.vtk.org/site/PythonicAPI/Snippets/GetTextPositions/) for this.

To get an idea of how these functions are used, please see:

- C++ [PlatonicSolids](https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids/)
- PythonicAPI: [PlatonicSolids](https://examples.vtk.org/site/PythonicAPI/GeometricObjects/PlatonicSolids/)

Here is what the old version looked like:

 ![TestPlatonicSolids](https://discourse.vtk.org/uploads/default/original/2X/0/075f2c4d8ec29b65414f7f546873fc909c4e0f56.png)

and this is the new version:

 ![TestPlatonicSolids](https://discourse.vtk.org/uploads/default/original/2X/e/e1e40e9eae2472a87a1316222694d2cf639ba3d9.png)

For a more complex example using all the above changes, see:

- C++ [ReadAllPolyDataTypesDemo](https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo/). Also in this example note the use of `vtk_cli11` and C++ `filesystem` - so much easier to process command line data and check for existence of files etc.
- PythonicAPI: [ReadAllPolyDataTypesDemo](https://examples.vtk.org/site/PythonicAPI/IO/ReadAllPolyDataTypesDemo/).

Here is what the old version looked like:

 ![TestReadAllPolyDataTypesDemo](https://discourse.vtk.org/uploads/default/original/2X/9/984ecd4f18e3f72d4cc0e28b62104a8a7371b6f5.png)

and this is the new version:

 ![TestReadAllPolyDataTypesDemo](https://discourse.vtk.org/uploads/default/original/2X/d/da01061e520686e5766f447d63024e4540b3ea9e.png)
