
.. 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

        Click :ref:`here <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:: default

    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.826 seconds)


.. _sphx_glr_download_gallery_scene_turntable_box.py:


.. only :: html

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



  .. 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-jupyter

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


.. only:: html

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

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