.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/07_ui/viz_card.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

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

        :ref:`Go to the end <sphx_glr_download_auto_examples_07_ui_viz_card.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_07_ui_viz_card.py:


====
Card
====

This example shows how to create a card.

First, some imports.

.. GENERATED FROM PYTHON SOURCE LINES 11-15

.. code-block:: Python


    import fury
    from fury.data import fetch_viz_icons


.. GENERATED FROM PYTHON SOURCE LINES 16-17

First we need to fetch some icons that are included in FURY.

.. GENERATED FROM PYTHON SOURCE LINES 17-20

.. code-block:: Python


    fetch_viz_icons()


.. GENERATED FROM PYTHON SOURCE LINES 21-22

Let's create a card and add it to the show manager

.. GENERATED FROM PYTHON SOURCE LINES 22-46

.. code-block:: Python


    img_url = (
        "https://raw.githubusercontent.com/fury-gl"
        "/fury-communication-assets/main/fury-logo.png"
    )

    title = "FURY"
    body = (
        "FURY - Free Unified Rendering in pYthon."
        "A software library for scientific visualization in Python."
    )

    card = fury.ui.elements.Card2D(
        image_path=img_url,
        title_text=title,
        body_text=body,
        image_scale=0.55,
        size=(300, 300),
        bg_color=(1, 0.294, 0.180),
        bg_opacity=0.8,
        border_width=5,
        border_color=(0.1, 0.4, 0.4),
    )


.. GENERATED FROM PYTHON SOURCE LINES 47-49

Now that the card has been initialised, we add it to the show
manager.

.. GENERATED FROM PYTHON SOURCE LINES 49-61

.. code-block:: Python


    current_size = (1000, 1000)
    show_manager = fury.window.ShowManager(size=current_size, title="FURY Card Example")

    show_manager.scene.add(card)
    # To interact with the UI, set interactive = True
    interactive = False

    if interactive:
        show_manager.start()

    fury.window.record(scene=show_manager.scene, out_path="card_ui.png", size=(1000, 1000))


.. _sphx_glr_download_auto_examples_07_ui_viz_card.py:

.. only:: html

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

    .. container:: sphx-glr-download sphx-glr-download-jupyter

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

    .. container:: sphx-glr-download sphx-glr-download-python

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

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: viz_card.zip <viz_card.zip>`


.. only:: html

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

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