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

.. only:: html

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

        Click :ref:`here <sphx_glr_download_gallery_scene_one_scene_four_cams.py>`
        to download the full example code

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

.. _sphx_glr_gallery_scene_one_scene_four_cams.py:


Single Scene in Multiple View boxes
===================================

Demonstrating a single scene that is shown in four different viewboxes,
each with a different camera.

Note:
    This example just creates four scenes using the same visual.
    Multiple views are currently not available. See #1124 how this could
    be achieved.

.. GENERATED FROM PYTHON SOURCE LINES 20-58



.. image-sg:: /gallery/scene/images/sphx_glr_one_scene_four_cams_001.png
   :alt: one scene four cams
   :srcset: /gallery/scene/images/sphx_glr_one_scene_four_cams_001.png
   :class: sphx-glr-single-img





.. code-block:: default


    import sys

    from vispy import app, scene, io

    canvas = scene.SceneCanvas(keys='interactive')
    canvas.size = 800, 600
    canvas.show()

    # Create four ViewBoxes
    vb1 = scene.widgets.ViewBox(border_color='white', parent=canvas.scene)
    vb2 = scene.widgets.ViewBox(border_color='white', parent=canvas.scene)
    vb3 = scene.widgets.ViewBox(border_color='white', parent=canvas.scene)
    vb4 = scene.widgets.ViewBox(border_color='white', parent=canvas.scene)
    scenes = vb1.scene, vb2.scene, vb3.scene, vb4.scene

    # Put viewboxes in a grid
    grid = canvas.central_widget.add_grid()
    grid.padding = 6
    grid.add_widget(vb1, 0, 0)
    grid.add_widget(vb2, 0, 1)
    grid.add_widget(vb3, 1, 0)
    grid.add_widget(vb4, 1, 1)

    # Create some visuals to show
    im1 = io.load_crate().astype('float32') / 255
    for par in scenes:
        image = scene.visuals.Image(im1, grid=(20, 20), parent=par)

    # Assign cameras
    vb1.camera = scene.BaseCamera()
    vb2.camera = scene.PanZoomCamera()
    vb3.camera = scene.TurntableCamera()
    vb4.camera = scene.FlyCamera()

    if __name__ == '__main__':
        if sys.flags.interactive != 1:
            app.run()


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

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


.. _sphx_glr_download_gallery_scene_one_scene_four_cams.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: one_scene_four_cams.py <one_scene_four_cams.py>`



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

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


.. only:: html

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

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