Creating Amazing Graphics Using Turtle Library
AMAZING GRAPHICS BY USING TURTLE LIBRARY IN PYTHON.
I am going to create amazing graphics Using Turtle Library in Python.
For this, I am using Pydroid 3 in Android, which is basically a IDE for Python in Android.
First, we have to import Turtle as "t" which helps us to create graphic in Python by the following code:-
import turtle as t
Now I am going to set the background colour of the screen by the following command:-
t.bgcolor("black")
And then the color of turtle by the given code:-
t.color("cyan")
Now I am making the upcoming commands repeat for 240 times by the following code:-
for i in range(240):
And then the commands:-
t.forward(i)
t.left(102)
And then write the final code:-
t.done()
And you can now run the code and see the illusion. The star in the center appears moving.
Whole code :-
import turtle as t
t.speed(100)
t.bgcolor("black")
t.color("cyan")
for i in range(240):
t.forward(i)
t.left(102)
t.done()
You can enjoy the following video.:-
Don't forget to Subscribe.
Comments
Post a Comment