.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/noise.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_noise.py: Noise ----- Simple example that uses the bitmap-context to show images of noise. .. GENERATED FROM PYTHON SOURCE LINES 7-28 .. code-block:: Python # run_example = true import numpy as np from rendercanvas.auto import RenderCanvas, loop canvas = RenderCanvas(update_mode="continuous") context = canvas.get_context("bitmap") @canvas.request_draw def animate(): w, h = canvas.get_logical_size() shape = int(h) // 4, int(w) // 4 bitmap = np.random.uniform(0, 255, shape).astype(np.uint8) context.set_bitmap(bitmap) loop.run() .. _sphx_glr_download_gallery_noise.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: noise.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: noise.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: noise.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_ .. only:: html Interactive example =================== This uses Pyodide. If this does not work, your browser may not have sufficient support for wasm/pyodide/wgpu (check your browser dev console). .. raw:: html