.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/gallery_schotter_line.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_auto_examples_gallery_schotter_line.py: Schotter-inspired line art ========================== .. GENERATED FROM PYTHON SOURCE LINES 6-42 .. image-sg:: /auto_examples/images/sphx_glr_gallery_schotter_line_001.png :alt: stotter_line.png :srcset: /auto_examples/images/sphx_glr_gallery_schotter_line_001.png :class: sphx-glr-single-img .. code-block:: default import random from turtlethread import Turtle def set_random_heading(turtle, mean, std): turtle.setheading(random.gauss(mean, std)) random.seed(42) needle = Turtle() height = 100 width = 50 step = 10 with needle.running_stitch(step): for j in range(height//4): std = j for i in range(width): set_random_heading(needle, 0, std) needle.forward(10) for i in range(2): set_random_heading(needle, 90, std) needle.forward(10) for i in range(width): set_random_heading(needle, 180, std) needle.forward(10) for i in range(2): set_random_heading(needle, 90, std) needle.forward(10) needle.save("stotter_line.jef") needle.save("stotter_line.png") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.190 seconds) .. _sphx_glr_download_auto_examples_gallery_schotter_line.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: gallery_schotter_line.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: gallery_schotter_line.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_