.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/07_ui/viz_shapes.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_07_ui_viz_shapes.py: ============== Simple Shapes ============== This example shows how to use the UI API. We will demonstrate how to draw some geometric shapes from FURY UI elements. First, a bunch of imports. .. GENERATED FROM PYTHON SOURCE LINES 12-16 .. code-block:: Python from fury import ui, window from fury.data import fetch_viz_icons .. GENERATED FROM PYTHON SOURCE LINES 17-18 First we need to fetch some icons that are included in FURY. .. GENERATED FROM PYTHON SOURCE LINES 18-21 .. code-block:: Python fetch_viz_icons() .. rst-class:: sphx-glr-script-out .. code-block:: none Data size is approximately 12KB Dataset is already in place. If you want to fetch it again please first remove the folder /Users/skoudoro/.fury/icons ({'icomoon.tar.gz': ('https://digital.lib.washington.edu/researchworks/bitstream/handle/1773/38478/icomoon.tar.gz', 'BC1FEEA6F58BA3601D6A0B029EB8DFC5F352E21F2A16BA41099A96AA3F5A4735')}, '/Users/skoudoro/.fury/icons') .. GENERATED FROM PYTHON SOURCE LINES 22-23 Let's draw some simple shapes. First, a rectangle. .. GENERATED FROM PYTHON SOURCE LINES 23-26 .. code-block:: Python rect = ui.Rectangle2D(size=(100, 100), position=(400, 400), color=(1, 0, 1)) .. GENERATED FROM PYTHON SOURCE LINES 27-28 Then we can draw a solid circle, or disk. .. GENERATED FROM PYTHON SOURCE LINES 28-31 .. code-block:: Python disk = ui.Disk2D(outer_radius=50, center=(400, 200), color=(1, 1, 0)) .. GENERATED FROM PYTHON SOURCE LINES 32-33 Add an inner radius to make a ring. .. GENERATED FROM PYTHON SOURCE LINES 33-37 .. code-block:: Python ring = ui.Disk2D(outer_radius=50, inner_radius=45, center=(500, 600), color=(0, 1, 1)) .. GENERATED FROM PYTHON SOURCE LINES 38-40 Now that all the elements have been initialised, we add them to the show manager. .. GENERATED FROM PYTHON SOURCE LINES 40-54 .. code-block:: Python current_size = (800, 800) show_manager = window.ShowManager(size=current_size, title='FURY Shapes Example') show_manager.scene.add(rect) show_manager.scene.add(disk) show_manager.scene.add(ring) interactive = False if interactive: show_manager.start() window.record(show_manager.scene, size=current_size, out_path='viz_shapes.png') .. image-sg:: /auto_examples/07_ui/images/sphx_glr_viz_shapes_001.png :alt: viz shapes :srcset: /auto_examples/07_ui/images/sphx_glr_viz_shapes_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.068 seconds) .. _sphx_glr_download_auto_examples_07_ui_viz_shapes.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: viz_shapes.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: viz_shapes.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_