.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_introductory/viz_integrate_with_qt.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_01_introductory_viz_integrate_with_qt.py: ================== Using FURY with Qt ================== This example demonstrates how to use FURY with a Qt application to create a simple GUI. It integrates FURY's rendering capabilities with Qt's event handling and widget system. .. GENERATED FROM PYTHON SOURCE LINES 10-65 .. code-block:: Python import numpy as np from fury.window import ShowManager, Scene from fury.lib import QtWidgets from fury.actor import sphere app = QtWidgets.QApplication.instance() or QtWidgets.QApplication([]) class Main(QtWidgets.QWidget): def __init__(self): super().__init__(None) self.resize(800, 800) self._button = QtWidgets.QPushButton("Hide Sphere", self) self._button.clicked.connect(self._on_button_click) self.scene = Scene(background=(0, 0, 0, 1)) self.show_manager = ShowManager( scene=self.scene, window_type="qt", title="Integrate Qt Example", qt_app=app, qt_parent=self, ) self._sphere_actor = sphere( np.zeros((1, 3)), colors=(1, 0, 1, 1), radii=15.0, phi=48, theta=48, ) self.scene.add(self._sphere_actor) layout = QtWidgets.QHBoxLayout() self.setLayout(layout) layout.addWidget(self._button) layout.addWidget(self.show_manager.window) def _on_button_click(self): if self._button.text() == "Show Sphere": self.scene.add(self._sphere_actor) self._button.setText("Hide Sphere") else: self.scene.remove(self._sphere_actor) self._button.setText("Show Sphere") self.show_manager.render() m = Main() m.setWindowTitle("FURY Qt Example") m.show_manager.start() .. _sphx_glr_download_auto_examples_01_introductory_viz_integrate_with_qt.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: viz_integrate_with_qt.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: viz_integrate_with_qt.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: viz_integrate_with_qt.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_