Skip to main content

Corona virus structure using Python turtle

 Python programming

Python program to make a corona virus structure using turtle framework.

import turtle

# setting the turtle object
trt = turtle.Turtle()
# now setting the canvas or screen

scr = turtle.Screen()
#setting the bg color
scr.bgcolor('black') #lets set to the black
#setting the screeen/window title

# making the turtle fast
trt.speed(0) # 0 means the fastest speed ...

scr.title('Corona virus Structure')
# now setting the turtle color

trt.color('green') # lets make it green

# now we have to make a loop to continuosly make the borders and structure

# use for loop

for x in range(210):
if x in range(50):
trt.hideturtle()
else:
trt.forward(10+x) #moving the turtle in forward direction ..........
trt.left(x) # rotating the turtle in left at the angle of x =[1,2,3,4........., 210]


# now closing the turtle movement and makin the screen stable
turtle.done()



Watch full video :


Comments

Popular posts from this blog

Python Turtle : Create a attractive Petal Design

 Python Turtle Attractive Petal design in Python  import turtle # create the turtle object trt = turtle.Turtle() # create the screen object scr = turtle.Screen() #increase the pensize trt.pensize( 3 ) # set the background color to black scr.bgcolor( 'black' ) # set the pencolor to white colors = [ 'red' , 'orange' , 'yellow' , 'skyblue' , 'blue' , 'indigo' , 'violet' ] # increase the speed trt.speed( 0 ) # now first create a single petal # lets define the distance dis = 50 trt.color( "yellow" ) for color in range ( 20 ): for j in range ( 1 , 8 ): trt.left( 50 ) for i in range ( 2 ): trt.forward(dis) trt.left( 60 ) #rotate at 60 degree in clockwise trt.forward(dis) trt.left( 120 ) #rotate at 120 degree in clockwise dis = dis + 5 #hide the turtle after the shape has been drawn trt.hideturtle() turtle.done() Output : Learn thr...

Python Turtle tutorials : Create a Bi-Pyramid structure

 Python Turtle Tutorials  Create a Bi-Pyramid structure using Python  Code :           """ Program to create a Bi-pyramid structure Source : CODE PROBLEM (Youtube) """ import turtle scr = turtle.Screen() # create screen object scr.bgcolor( 'black' ) turtle.speed( 0 ) # the fastest speed turtle.pensize( 2 ) # set the width of the drawing pen turtle.color( 'skyblue' ) # set pencolor to 'skyblue' for i in range ( 30 ): turtle.fd(i* 10 ) turtle.right( 120 ) for j in range ( 29 , 0 ,- 1 ): turtle.fd(j* 10 ) # move forward turtle.left( 120 ) turtle.hideturtle() # hiding the turtle after the completion of the drawing turtle.done() # for holding the screen Output : Learn from video : Watch on youtube

Create a Rainbow Colored Benzene Structure using Python Turtle

  PYTHON TURTLE Create a Rainbow Colored Benzene Structure import turtle #import the turtle library trt = turtle.Turtle() #initialize the turtle object scr = turtle.Screen()     #initialize the Screen object scr.bgcolor( 'black' )          #set the background color to "black" scr.title( 'Color Benzene' ) #title of the scren trt.speed( 0 ) #speed of the drawing rainbow = [ 'red' , 'orange' , 'yellow' , 'green' , 'blue' , 'indigo' ] #colors to be used for i in range( 300 ): trt.pencolor(rainbow[i% 6 ]) trt.width(i/ 100 + 1 ) trt.forward(i) trt.left( 59 ) turtle.done() trt.hideturtle() Watch the video :