.. note::
    :class: sphx-glr-download-link-note

    Click :ref:`here <sphx_glr_download_auto_tutorials_02_ui_viz_shapes.py>` to download the full example code
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_tutorials_02_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 DIPY UI elements.

First, a bunch of imports.


.. code-block:: default


    from fury import ui, window







Let's draw some simple shapes. First, a rectangle.


.. code-block:: default


    rect = ui.Rectangle2D(size=(100, 100), position=(400, 400), color=(1, 0, 1))







Then we can draw a solid circle, or disk.


.. code-block:: default


    disk = ui.Disk2D(outer_radius=50, center=(400, 200), color=(1, 1, 0))







Add an inner radius to make a ring.


.. code-block:: default


    ring = ui.Disk2D(outer_radius=50, inner_radius=45,
                     center=(500, 600), color=(0, 1, 1))








Now that all the elements have been initialised, we add them to the show
manager.


.. code-block:: default


    current_size = (800, 800)
    show_manager = window.ShowManager(size=current_size,
                                      title="DIPY 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:: /auto_tutorials/02_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.100 seconds)


.. _sphx_glr_download_auto_tutorials_02_ui_viz_shapes.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download

     :download:`Download Python source code: viz_shapes.py <viz_shapes.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: viz_shapes.ipynb <viz_shapes.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_