21 Sep turtle.shearfactor() function in Python
The turtle.shearfactor() function sets or returns the current shear factor, which skews the turtle’s shape perpendicular to its heading.
Syntax: turtle.shearfactor(shear=None)
Parameters: shear – a number (the shear factor; tangent of the shear angle).
Let us see an example to implement the turtle.shearfactor() function in Python:
Demo45.py
# turtle.shearfactor() function in Python # Code by Studyopedia import turtle window = turtle.Screen() t = turtle.Turtle() t.shearfactor(0.5) # Apply shear transformation t.forward(100) window.exitonclick()
The following is the output:

In the above code, we followed the below steps:
- Import module: import turtle loads the turtle graphics library.
- Create screen: window = turtle.Screen() opens the drawing window.
- Create turtle: t = turtle.Turtle() creates the turtle you’ll control.
- Apply shear: t.shearfactor(0.5) skews the turtle’s shape (appearance) with a horizontal shear factor of 0.5, slanting it to the right. This affects only the shape’s look, not its movement or heading.
- Move forward: t.forward(100) moves 100 units in the current heading (drawing if the pen is down).
- Close on click: window.exitonclick() waits for a mouse click, then closes the window.
If you liked the tutorial, spread the word and share the link and our website, Studyopedia, with others.
For Videos, Join Our YouTube Channel: Join Now
Read More:
- OpenCV Tutorial
- Python Tutorial
- NumPy Tutorial
- Pandas Tutorial
- Matplotlib Tutorial
- Generative AI Tutorial
- LangChain Tutorial
- RAG Tutorial
- Machine Learning Tutorial
- Deep Learning Tutorial
- Ollama Tutorial
- Retrieval Augmented Generation (RAG) Tutorial
- Copilot Tutorial
- Gemini Tutorial
- ChatGPT Tutorial
No Comments