
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/scene/grid_layout/grid_basic.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_grid_layout_grid_basic.py>`
        to download the full example code.

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

.. _sphx_glr_gallery_scene_grid_layout_grid_basic.py:


Simple use of a grid layout
===========================


+-----+-----+
|     |     |
|  1  |  2  |
|     |     |
+-----+-----+

.. GENERATED FROM PYTHON SOURCE LINES 19-41



.. image-sg:: /gallery/scene/grid_layout/images/sphx_glr_grid_basic_001.png
   :alt: grid basic
   :srcset: /gallery/scene/grid_layout/images/sphx_glr_grid_basic_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    import sys

    from vispy import scene, app

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

    # This is the top-level widget that will hold three ViewBoxes, which will
    # be automatically resized whenever the grid is resized.
    grid = canvas.central_widget.add_grid()

    widget_left = grid.add_widget(row=0, col=0)
    widget_left.bgcolor = "#dd0000"

    widget_right = grid.add_widget(row=0, col=1)
    widget_right.bgcolor = "#0000dd"

    canvas.show()

    if __name__ == '__main__' and sys.flags.interactive == 0:
        app.run()


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

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


.. _sphx_glr_download_gallery_scene_grid_layout_grid_basic.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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