Friday, October 24, 2025
HomeLanguagesturtle.shearfactor() function in Python

turtle.shearfactor() function in Python

The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.

turtle.shearfactor()

This function is used to set or return the current shearfactor. It Shears the turtleshape according to the given shearfactor shear, which is the tangent of the shear angle. 

Syntax : turtle.shearfactor(shear=None)

Parameter: 

shear(optional): number, tangent of the shear angle.

Below is the implementation of the above method with some examples :

Example 1 :

Python3




# importing package
import turtle
  
# set turtle
turtle.speed(1)
turtle.shape("turtle")
turtle.up()
turtle.goto(-150,0)
turtle.down()
  
# forward turtle by 100
turtle.forward(100)
  
# set shear by +ive value
turtle.shearfactor(0.2)
  
# forward turtle by 100
turtle.forward(100)
  
# set shear by -ive value
turtle.shearfactor(-0.2)
  
# forward turtle by 100
turtle.forward(100)


Output :

Example 2 :

Python3




# importing package
import turtle
  
# set turtle 
turtle.speed(1)
turtle.up()
turtle.goto(-40,40)
turtle.down()
  
# set shear and apply to
# all shapes
turtle.shearfactor(0.5)
  
# get shape
sh=turtle.getshapes()
  
# loop for pattern
for i in range(len(sh)):
    turtle.shape(sh[i])
    turtle.forward(100+10*i)
    turtle.right(90)
    turtle.forward(100+10*i)
    turtle.right(90)


Output :

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS