diff --git a/doc/changelog.d/354.miscellaneous.md b/doc/changelog.d/354.miscellaneous.md new file mode 100644 index 00000000..94ed8586 --- /dev/null +++ b/doc/changelog.d/354.miscellaneous.md @@ -0,0 +1 @@ +Fix: Remove buttons in screenshots diff --git a/examples/00-basic-pyvista-examples/plain_usage.py b/examples/00-basic-pyvista-examples/plain_usage.py index b4520c67..c02aca1c 100644 --- a/examples/00-basic-pyvista-examples/plain_usage.py +++ b/examples/00-basic-pyvista-examples/plain_usage.py @@ -70,7 +70,7 @@ pl.plot(mesh) # Show the plotter -pl.show(screenshot="screenshot.png") +pl.show() ###################### diff --git a/src/ansys/tools/visualization_interface/backends/pyvista/widgets/screenshot.py b/src/ansys/tools/visualization_interface/backends/pyvista/widgets/screenshot.py index 5b9b38e0..c23281aa 100644 --- a/src/ansys/tools/visualization_interface/backends/pyvista/widgets/screenshot.py +++ b/src/ansys/tools/visualization_interface/backends/pyvista/widgets/screenshot.py @@ -67,7 +67,13 @@ def callback(self, state: bool) -> None: This method provides a callback function for the screenshot widget. It is called every time the screenshot widget is clicked. """ + for widget in self.plotter._widgets: + widget._button.GetRepresentation().SetVisibility(0) + self._plotter._pl.scene.render() self.plotter._pl.scene.screenshot("screenshot.png") + for widget in self.plotter._widgets: + widget._button.GetRepresentation().SetVisibility(1) + self._plotter._pl.scene.render() def update(self) -> None: """Define the configuration and representation of the screenshot widget button."""