.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/feature_demo/line_thick.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_feature_demo_line_thick.py: Thick Lines =========== Display very thick lines to show how lines stay pretty on large scales. .. GENERATED FROM PYTHON SOURCE LINES 7-45 .. image-sg:: /_gallery/feature_demo/images/sphx_glr_line_thick_001.webp :alt: line thick :srcset: /_gallery/feature_demo/images/sphx_glr_line_thick_001.webp :class: sphx-glr-single-img .. code-block:: Python import random from wgpu.gui.auto import WgpuCanvas, run import pygfx as gfx canvas = WgpuCanvas() renderer = gfx.WgpuRenderer(canvas) # A straight line line1 = [[100, 100], [100, 200], [100, 200], [100, 400]] # A line with a 180 degree turn (a bit of a special case for the implementation) line2 = [[200, 100], [200, 400], [200, 100]] # A swiggly line line3 = [[300 + random.randint(-10, 10), 100 + i * 3] for i in range(100)] # A line with other turns line4 = [[400, 100], [500, 200], [400, 300], [450, 400]] scene = gfx.Scene() material = gfx.LineMaterial(thickness=80.0, color=(0.8, 0.7, 0.0, 1.0)) for line in [line1, line2, line3, line4]: line = [(*pos, 0) for pos in line] # Make the positions vec3 geometry = gfx.Geometry(positions=line) line = gfx.Line(geometry, material) scene.add(line) camera = gfx.ScreenCoordsCamera() if __name__ == "__main__": canvas.request_draw(lambda: renderer.render(scene, camera)) run() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.240 seconds) .. _sphx_glr_download__gallery_feature_demo_line_thick.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: line_thick.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: line_thick.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: line_thick.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_