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

.. only:: html

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

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

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

.. _sphx_glr_gallery_scene_turntable_box.py:


Display a Cube
==============

Simple use of SceneCanvas to display a cube with an arcball camera.

.. GENERATED FROM PYTHON SOURCE LINES 13-31



.. image-sg:: /gallery/scene/images/sphx_glr_turntable_box_001.png
   :alt: turntable box
   :srcset: /gallery/scene/images/sphx_glr_turntable_box_001.png
   :class: sphx-glr-single-img





.. code-block:: Python

    import sys

    from vispy import scene
    from vispy.color import Color
    canvas = scene.SceneCanvas(keys='interactive', size=(800, 600), show=True)

    # Set up a viewbox to display the cube with interactive arcball
    view = canvas.central_widget.add_view()
    view.bgcolor = '#efefef'
    view.camera = 'turntable'
    view.padding = 100

    color = Color("#3f51b5")

    cube = scene.visuals.Box(1, 1, 1, color=color, edge_color="black",
                             parent=view.scene)
    if __name__ == '__main__' and sys.flags.interactive == 0:
        canvas.app.run()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 0.798 seconds)


.. _sphx_glr_download_gallery_scene_turntable_box.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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