![]() pencolor(‘cyan’) is used to give the color to the pen.backward(heigh/2) is used to move the turtle in the backward direction.shape(‘circle’) is used to give the shape of a circle.fillcolor(‘cyan’) is used to fill the color inside the shape.shape(‘square’) is used to give the shape of a square.rad, heigh = is used to give radius and height in pixel to the circle.In the following code, we will import the turtle library from turtle import *, import turtle. The center of the bases is joined by a line segment. It has straight parallel sides and curved or oval bases. In this section, we will learn about how to draw a 3d cylinder with the help of a turtle in a python turtle.Ī three-dimension cylinder is a solid geometrical figure. Read: Python Turtle Random Python turtle 3d cylinder tur.hideturtle() is used for hiding the turtle.Īfter running the above code, we get the following output in which we can see that a beautiful 3d sphere is drawn on the screen.tur.color(col) is used to give color to the sphere.tur.seth(-val) is used to orient the sphere at angle = -val.tur.speed(100) give the speed to the turtle.screen.bgcolor(‘black’) is used to give color to thebackground.tup(500,500) is used to give the size to the screen.tur.circle(rad,90) is used to draw the circle. ![]() Each point of the sphere surface is equidistant from its center The surface area of a sphere is 4×3.14xr^3. In this section, we will learn about how to draw a 3d sphere with the help of a turtle in a python turtle. Read: Python Turtle Background Python turtle 3d sphere
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |