├── requirements.txt ├── rdj.py ├── impresscrush.py ├── rainbow-benzene.py ├── design2.py ├── windows-logo.py ├── cool.py ├── Vortex of Filled Squares.py ├── spotify.py ├── virus.py ├── instagram-logo.py ├── README.md ├── olympic-logo.py ├── design.py ├── cred.py ├── insta-reel.py ├── flag-hosting.py ├── captainamericashield.py ├── LICENSE ├── spiderman-logo.py ├── christmas-tree.py ├── batman.py ├── sasuke-mangekyou-sharingan.py ├── panda.py ├── indianflag-logo.py ├── google-logo.py ├── netflix-logo.py ├── ironman.py ├── happy-halloween.py ├── among-us.py ├── Five Shapes.py ├── python-logo.py ├── happy-new-year.py ├── avenger-logo.py ├── dell.py ├── tesla-logo.py ├── batman2.py ├── halloween.py ├── usa-flag.py ├── i-love-you.py ├── planet-simulator.py ├── spiderman.py ├── superman-logo.py ├── happy-diwali-1.py ├── saraswati.py ├── solar-system.py ├── doraemon.py ├── goku.py ├── happy_diwali.py ├── micky-mouse.py ├── shinchan.py └── pikachu.py /requirements.txt: -------------------------------------------------------------------------------- 1 | sketchpy 2 | turtle 3 | -------------------------------------------------------------------------------- /rdj.py: -------------------------------------------------------------------------------- 1 | from sketchpy import library as lib 2 | obj=lib.rdj() 3 | obj.draw() -------------------------------------------------------------------------------- /impresscrush.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | color('red') 3 | begin_fill() 4 | pensize(3) 5 | left(50) 6 | forward(133) 7 | circle(50,200) 8 | right(140) 9 | circle(50,200) 10 | forward(133) 11 | end_fill() 12 | done() -------------------------------------------------------------------------------- /rainbow-benzene.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | colors = ['red', 'purple', 'blue', 'green', 'orange', 'yellow'] 4 | 5 | t = turtle.Pen() 6 | 7 | turtle.bgcolor('black') 8 | 9 | for x in range(360): 10 | 11 | t.pencolor(colors[x%6]) 12 | 13 | t.width(x//100 + 1) 14 | 15 | t.forward(x) 16 | 17 | t.left(59) -------------------------------------------------------------------------------- /design2.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import colorsys 3 | 4 | t = turtle.Turtle() 5 | turtle.Screen().bgcolor("Black") 6 | t.pensize(2) 7 | t.speed(10) 8 | n = 36 9 | h = 0 10 | for i in range(60): 11 | c = colorsys.hsv_to_rgb(h, 1, 0.9) 12 | h += 1/n 13 | t.pencolor(c) 14 | t.forward(i*4) 15 | t.left(100) 16 | t.forward(i*3 - 20) 17 | t.left(200) 18 | turtle.done() -------------------------------------------------------------------------------- /windows-logo.py: -------------------------------------------------------------------------------- 1 | #import the turtle library as t 2 | from turtle import * 3 | #change the pen speed 4 | speed(1) 5 | #change the screen color 6 | bgcolor("black") 7 | penup() 8 | #change the pen position 9 | goto(-50,60) 10 | pendown() 11 | color('#00adef') 12 | begin_fill() 13 | #change the position 14 | goto(100,100) 15 | goto(100,-100) 16 | goto(-50,-60) 17 | 18 | goto(-50,60) 19 | end_fill() 20 | 21 | color("black") 22 | goto(15,100) 23 | color("black") 24 | width(10) 25 | goto(15,-100) 26 | penup() 27 | 28 | goto(100,0) 29 | pendown() 30 | 31 | goto(-100,0) 32 | 33 | done() -------------------------------------------------------------------------------- /cool.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | from time import sleep 3 | 4 | bgcolor("black") 5 | t = [Turtle(), Turtle()] 6 | x = 6 7 | colors = ["red", "yellow", "blue", "lime"] 8 | for index, i in enumerate(t): 9 | i.speed(0) 10 | i.color("white") 11 | i.shape("circle") 12 | i.shapesize(0.3) 13 | i.width(3) 14 | i.pu() 15 | i.seth(90) 16 | i.fd(350) 17 | i.seth(-180) 18 | i.pd() 19 | t[0].pu() 20 | 21 | delay(0) 22 | speed(0) 23 | ht() 24 | sleep(4) 25 | for i in colors: 26 | color(i) 27 | for i in range(360): 28 | t[0].fd(x) 29 | t[0].lt(1) 30 | pu() 31 | goto(t[0].pos()) 32 | pd() 33 | t[1].fd(2 * x) 34 | t[1].lt(2) 35 | goto(t[1].pos()) 36 | done() -------------------------------------------------------------------------------- /Vortex of Filled Squares.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import random 3 | 4 | turtle.speed(0) 5 | turtle.setup(1000, 700) 6 | turtle.title('Vortex of Filled Squares') 7 | turtle.bgcolor('black') 8 | turtle.hideturtle() 9 | 10 | def draw_square(x,y,size,tilt_angle,c): 11 | turtle.up() 12 | turtle.goto(x, y) 13 | turtle.down() 14 | turtle.seth(tilt_angle) 15 | turtle.fillcolor(c) 16 | turtle.begin_fill() 17 | for i in range(4): 18 | turtle.fd(size) 19 | turtle.left(90) 20 | turtle.end_fill() 21 | angle = 0 22 | size = 240 23 | while size > 0: 24 | draw_square(0,0,size,angle,(random.uniform(0,1),random.uniform(0,1),random.uniform(0,1))) 25 | size -= 0.1 26 | angle +=3 27 | turtle.done() -------------------------------------------------------------------------------- /spotify.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | t.Screen().bgcolor("Black") 3 | t.speed(15) 4 | t.begin_fill() 5 | t.fillcolor('#1DB954') 6 | t.pencolor("#1DB954") 7 | t.pensize(0) 8 | t.circle(100) 9 | t.end_fill() 10 | t.penup() 11 | t.goto(40,50) 12 | t.pendown() 13 | t.left(150) 14 | t.forward(0) 15 | t.pensize(15) 16 | t.pencolor('black') 17 | t.circle(80,60) 18 | t.penup() 19 | 20 | t.goto(50,85) 21 | t.pendown() 22 | t.pensize(17) 23 | t.right(60) 24 | t.forward(0) 25 | t.circle(100,60) 26 | 27 | t.penup() 28 | t.goto(60,120) 29 | t.pendown() 30 | t.pensize(20) 31 | t.right(60) 32 | t.forward(0) 33 | t.circle(120,60) 34 | 35 | t.penup() 36 | t.goto(130, 55) 37 | t.pendown() 38 | t.color("#1DB954") 39 | t.write("Spotify", font=("Arial", 16, "bold")) 40 | 41 | t.done() -------------------------------------------------------------------------------- /virus.py: -------------------------------------------------------------------------------- 1 | #Import Turtle 2 | import turtle 3 | 4 | tt=turtle.Turtle() 5 | turtle.bgcolor("yellow")#Screen background color set to gray 6 | tt.pencolor("black")#Pencolor set to black 7 | 8 | tt.speed(0) 9 | tt.penup() 10 | tt.goto(0,200)#position of the turtle 11 | tt.pendown() 12 | 13 | #Intialization of variables 14 | forDis=0 15 | dR=0 16 | 17 | while(True): 18 | tt.forward(forDis) 19 | tt.right(dR) 20 | forDis+=3 # forDis increased by 3 on every iteration 21 | dR+=1# right angle distance increased by 1 on every iteration 22 | #If the distance for right angle becomes 210 the loop breaks 23 | if dR==210: 24 | break 25 | #Hide the turtle on completion of loop 26 | tt.hideturtle() 27 | 28 | #Completion of Turtle execution 29 | turtle.done() -------------------------------------------------------------------------------- /instagram-logo.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | speed(20) 3 | def insta1(x,y) : 4 | penup() 5 | goto(x,y) 6 | pendown() 7 | def insta2(x,y,f,c,c1,c2): 8 | color(c) 9 | insta1(x,y) 10 | begin_fill() 11 | for i in range (4): 12 | forward(f) 13 | circle(c1,c2) 14 | end_fill() 15 | def insta3(c,x,y,c1): 16 | color(c) 17 | begin_fill() 18 | insta1(x,y) 19 | circle(c1) 20 | end_fill() 21 | 22 | insta2(-150, -120, 350,"pink",20,90) 23 | insta2(-110,-70,260,"white",20,90) 24 | insta2(-90,-50,220,"pink",20,90) 25 | insta3("white",20,10,70) 26 | insta3("pink",20,30,50) 27 | insta3("white",110,160,15) 28 | 29 | color("red") 30 | insta1(-120,-180) 31 | write("INSTAGRAM", font=("CALIBRI", 40, "bold")) 32 | hideturtle() 33 | done() -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

30 Days Of Python Challenge

2 |

Hi Guys, MySelf Sumalya Chatterjee. On 1st of January I started a YouTube Channel. And Challenged Myself To Code And Upload GUI Projects In Python. So On That Day Regularly This Repo Is Updating. Hope You Like My Projects.

3 | 4 | # 5 |

Here's The Videos Of All Codes 👇👇👇

6 |

View How All Code Works

7 | 8 | # 9 |

If You Like This Series, Your One Support Means A Lot To Me 😇😇😊😊😊😊😊😊

10 |

Show Support 👇👇👇

11 | https://www.buymeacoffee.com/r3dhulk

12 | 13 | -------------------------------------------------------------------------------- /olympic-logo.py: -------------------------------------------------------------------------------- 1 | #Python Program to draw Olympics logo in Turtle Programming 2 | import turtle 3 | 4 | t = turtle.Turtle() 5 | turtle.bgcolor('#ba161e') # Dark Red 6 | t.pensize(6) #Set the thickness of the pen to 6 7 | firstRowColors = ["blue", "black", "red"] #firstRowColors is a list of colors that are present in the first row of logo 8 | for i in range(3): 9 | t.penup() 10 | t.pencolor(firstRowColors[i]) 11 | t.goto(i*110, 0) 12 | t.pendown() 13 | t.circle(50) 14 | 15 | secondRowColors = ["", "yellow", "", "green"] 16 | for i in range(1, 4, 2): 17 | t.penup() 18 | t.pencolor(secondRowColors[i]) 19 | t.goto(i*55, -50) 20 | t.pendown() 21 | t.circle(50) 22 | 23 | t.setposition(300,300) 24 | t.pencolor("red") 25 | 26 | t.write("Code by Sumalya Chatterjee") 27 | 28 | t.hideturtle() 29 | turtle.done() -------------------------------------------------------------------------------- /design.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | 3 | import colorsys 4 | 5 | t.title("Python Design") 6 | 7 | t.bgcolor("black") 8 | 9 | t.speed("fastest") 10 | 11 | t.tracer(100) 12 | 13 | t.pencolor("darkviolet") 14 | 15 | hue = 0.7 16 | 17 | t.hideturtle() 18 | 19 | 20 | def func(): 21 | 22 | global hue 23 | 24 | for i in range(4): 25 | 26 | global hue 27 | 28 | for i in range(4): 29 | 30 | color = colorsys.hsv_to_rgb(hue, 1, 1) 31 | 32 | hue += 0.001 33 | 34 | t.fillcolor(color) 35 | 36 | t.begin_fill() 37 | 38 | t.fd(100) 39 | 40 | t.right(18) 41 | 42 | t.fd(100) 43 | 44 | t.lt(22) 45 | 46 | t.end_fill() 47 | 48 | 49 | for j in range(400): 50 | 51 | func() 52 | 53 | t.goto(8, 8) 54 | 55 | t.rt(188) 56 | 57 | 58 | t.exitonclick() 59 | -------------------------------------------------------------------------------- /cred.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | turtle.Screen().bgcolor("black") 3 | t=turtle.Turtle() 4 | t.goto(-166,100) 5 | t.width(5) 6 | t.color("white") 7 | t.forward(256) 8 | t.right(90) 9 | t.forward(220) 10 | t.right(60) 11 | t.forward(150) 12 | t.right(60) 13 | t.forward(150) 14 | t.right(60) 15 | t.forward(220) 16 | 17 | t.penup() 18 | t.goto(-86,50) 19 | t.pendown() 20 | t.right(90) 21 | t.forward(136) 22 | t.right(90) 23 | t.forward(60) 24 | t.color("black") 25 | t.forward(40) 26 | t.color("white") 27 | t.forward(40) 28 | t.right(60) 29 | 30 | t.forward(104) 31 | t.right(60) 32 | t.forward(104) 33 | t.right(60) 34 | t.forward(106) 35 | t.right(90) 36 | t.forward(130) 37 | 38 | 39 | t.penup() 40 | t.goto(10,-75) 41 | t.pendown() 42 | t.right(150) 43 | t.forward(57) 44 | t.right(60) 45 | t.forward(57) 46 | t.right(60) 47 | t.forward(30) 48 | t.penup() 49 | t.goto(-163,-300) 50 | t.pendown() 51 | 52 | 53 | t.write("CRED",font=("Sentic",25,"normal")) 54 | 55 | turtle.done() -------------------------------------------------------------------------------- /insta-reel.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | t.speed(100) 3 | t.bgcolor('#fb3958') 4 | t.pencolor('white') 5 | t.pensize(10) 6 | t.penup() 7 | t.goto(100,100) 8 | t.pendown() 9 | t.left(180) 10 | def border(): 11 | t.forward(150) 12 | for i in range(90): 13 | t.forward(1) 14 | t.left(1) 15 | 16 | border() 17 | border() 18 | border() 19 | border() 20 | 21 | t.penup() 22 | # Creating A Horizontal Line and One Diagonal Line 23 | for i in range(90): 24 | t.backward(1) 25 | t.right(1) 26 | t.left(90) 27 | t.pendown() 28 | t.forward(259) 29 | t.penup() 30 | t.right(180) 31 | t.forward(85) 32 | t.left(120) 33 | t.pendown() 34 | t.forward(60) 35 | t.right(120) 36 | 37 | # Draw another Diagonal Line 38 | t.penup() 39 | t.forward(100) 40 | t.right(60) 41 | t.pendown() 42 | t.forward(60) 43 | 44 | #Draw a Triangle 45 | t.penup() 46 | t.goto(5,-20) 47 | t.left(60) 48 | t.right(90) 49 | t.pendown() 50 | for i in range(3): 51 | t.forward(70) 52 | t.left(120) 53 | t.hideturtle() 54 | t.done() -------------------------------------------------------------------------------- /flag-hosting.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | import turtle as tur 3 | def rectangle(color): 4 | turt.begin_fill() 5 | turt.fillcolor(color) 6 | for i in range(2): 7 | turt.forward(400) 8 | turt.right(90) 9 | turt.forward(100) 10 | turt.right(90) 11 | turt.end_fill() 12 | 13 | turt=tur.Turtle() 14 | tur.screensize(500,400) 15 | tur.title("Pythontpoint") 16 | turt.up() 17 | turt.pensize(4) 18 | turt.goto(0,-300) 19 | turt.down() 20 | turt.goto(0,400) 21 | rectangle("orange") 22 | turt.goto(0,300) 23 | turt.forward(200) 24 | turt.color("blue") 25 | turt.circle(-50) 26 | turt.setheading(270) 27 | turt.forward(50) 28 | turt.setheading(0) 29 | for i in range(24): 30 | turt.forward(45) 31 | turt.bk(45) 32 | turt.left(15) 33 | turt.setheading(90) 34 | turt.forward(50) 35 | turt.setheading(0) 36 | turt.color("black") 37 | turt.forward(200) 38 | turt.right(90) 39 | turt.forward(100) 40 | turt.right(90) 41 | turt.forward(400) 42 | turt.right(90) 43 | turt.forward(100) 44 | turt.right(90) 45 | turt.goto(0,200) 46 | rectangle("green") 47 | tur.done() -------------------------------------------------------------------------------- /captainamericashield.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import math 3 | 4 | t = turtle.Turtle() 5 | turtle.bgcolor('black') 6 | 7 | def hulk(x, y): 8 | t.penup() 9 | t.goto(x, y) 10 | t.pendown() 11 | t.setheading(0) 12 | t.pensize(2) 13 | t.speed(10) 14 | 15 | 16 | def golo(r, color): 17 | x_point = 0 18 | y_pont = -r 19 | hulk(x_point, y_pont) 20 | t.pencolor(color) 21 | t.fillcolor(color) 22 | t.begin_fill() 23 | t.circle(r) 24 | t.end_fill() 25 | 26 | 27 | def sumalya(r, color): 28 | hulk(0, 0) 29 | t.pencolor(color) 30 | t.setheading(162) 31 | t.forward(r) 32 | t.setheading(0) 33 | t.fillcolor(color) 34 | t.begin_fill() 35 | for i in range(5): 36 | t.forward(math.cos(math.radians(18)) * 2 * r) # 2cos18°*r 37 | t.right(144) 38 | t.end_fill() 39 | t.hideturtle() 40 | 41 | 42 | if __name__ == '__main__': 43 | golo(288, 'crimson') 44 | golo(234, 'snow') 45 | golo(174, 'crimson') 46 | golo(114, 'blue') 47 | sumalya(114, 'snow') 48 | turtle.done() -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Sumalya Chatterjee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /spiderman-logo.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | bgcolor('red') 3 | pensize(10) 4 | fillcolor('black') 5 | begin_fill() 6 | circle(20) 7 | end_fill() 8 | penup() 9 | right(90) 10 | forward(5) 11 | pendown() 12 | fillcolor('black') 13 | begin_fill() 14 | right(60) 15 | for i in range(6): 16 | forward(50) 17 | left(60) 18 | end_fill() 19 | penup() 20 | left(150) 21 | forward(39) 22 | left(90) 23 | forward(9) 24 | pendown() 25 | forward(25) 26 | right(60) 27 | forward(15) 28 | left(60) 29 | forward(25) 30 | penup() 31 | backward(25) 32 | right(60) 33 | back(15) 34 | left(60) 35 | backward(25) 36 | left(60) 37 | pendown() 38 | backward(35) 39 | left(120) 40 | forward(80) 41 | penup() 42 | left(40) 43 | forward(30) 44 | left(140) 45 | pendown() 46 | forward(110) 47 | left(60) 48 | forward(40) 49 | right(60) 50 | forward(7) 51 | right(60) 52 | forward(20) 53 | left(60) 54 | forward(40) 55 | penup() 56 | goto(0,0) 57 | left(90) 58 | forward(39) 59 | right(90) 60 | forward(9) 61 | pendown() 62 | forward(25) 63 | left(60) 64 | forward(15) 65 | right(60) 66 | forward(25) 67 | penup() 68 | backward(25) 69 | left(60) 70 | back(15) 71 | right(60) 72 | backward(25) 73 | right(60) 74 | pendown() 75 | backward(35) 76 | right(120) 77 | forward(80) 78 | penup() 79 | right(40) 80 | forward(30) 81 | right(140) 82 | pendown() 83 | forward(110) 84 | right(60) 85 | forward(40) 86 | left(60) 87 | forward(7) 88 | left(60) 89 | forward(20) 90 | right(60) 91 | forward(40) 92 | done() -------------------------------------------------------------------------------- /christmas-tree.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | 3 | #writing speed 4 | speed(0) 5 | 6 | penup() 7 | goto(0, -250) 8 | pendown() 9 | #change the bg color 10 | color("lightskyblue") 11 | begin_fill() 12 | circle(250) 13 | end_fill() 14 | 15 | # Tree Trunk 16 | penup() 17 | goto(-15, -50) 18 | pendown() 19 | color("brown") 20 | begin_fill() 21 | for i in range(2): 22 | forward(30) 23 | right(90) 24 | forward(40) 25 | right(90) 26 | end_fill() 27 | 28 | # Set the start position and the inital tree width 29 | y = -50 30 | width = 240 31 | height = 25 32 | 33 | while width > 20: 34 | width = width - 30 # Make the tree get smaller as it goes up in height 35 | x = 0 - width / 2 # Set the starting x-value of each level of the tree 36 | color("green") 37 | penup() 38 | goto(x, y) 39 | pendown() 40 | begin_fill() 41 | for i in range(2): 42 | forward(width) 43 | left(90) 44 | forward(height) 45 | left(90) 46 | end_fill() 47 | 48 | y = y + height # Keep drawing the levels of the tree higher than the previous 49 | 50 | # Star 51 | penup() 52 | goto(-15, 150) 53 | pendown() 54 | color("yellow") 55 | begin_fill() 56 | for i in range(5): 57 | forward(30) 58 | right(144) 59 | end_fill() 60 | 61 | # Message 62 | penup() 63 | goto(-130, -150) 64 | color("red") 65 | write("MERRY CHRISTMAS", font=("Arial", 20, "bold")) 66 | penup() 67 | goto(-130, -200) 68 | color("black") 69 | 70 | write("Coded By Sumalya Chatterjee", font=("Arial", 10)) 71 | 72 | 73 | hideturtle() 74 | done() -------------------------------------------------------------------------------- /batman.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | #initialize method 4 | bat = turtle.Turtle() 5 | 6 | #size of pointer and pen 7 | bat.turtlesize(1, 1, 1) 8 | bat.pensize(3) 9 | 10 | #screen info 11 | wn = turtle.Screen() 12 | wn.bgcolor("black") 13 | wn.title("BATMAN") 14 | 15 | #colour 16 | bat.color("yellow", "black") 17 | 18 | 19 | #begin filling color 20 | bat.begin_fill() 21 | 22 | #turn1 23 | bat.left(90) # turn pointer direction to left of 90' 24 | bat.circle(50, 85) #draw circle of radius = 50 and 85' 25 | bat.circle(15, 110) 26 | bat.right(180) 27 | 28 | #turn 2 29 | bat.circle(30, 150) 30 | bat.right(5) 31 | bat.forward(10) #draw forward line of 10 units 32 | 33 | #turn 3 34 | bat.right(90) 35 | bat.circle(-70, 140) 36 | bat.forward(40) 37 | bat.right(110) 38 | 39 | #turn 4 40 | bat.circle(100, 30) 41 | bat.circle(30, 100) 42 | bat.left(50) 43 | bat.forward(50) 44 | bat.right(145) 45 | 46 | #turn5 47 | bat.forward(30) 48 | bat.left(55) 49 | bat.forward(10) 50 | 51 | #reverse 52 | 53 | #turn 5 54 | bat.forward(10) 55 | bat.left(55) 56 | bat.forward(30) 57 | 58 | #turn 4 59 | 60 | bat.right(145) 61 | bat.forward(50) 62 | bat.left(50) 63 | bat.circle(30, 100) 64 | bat.circle(100, 30) 65 | 66 | #turn 3 67 | bat.right(90) 68 | bat.right(20) 69 | bat.forward(40) 70 | bat.circle(-70, 140) 71 | 72 | #turn 2 73 | bat.right(90) 74 | bat.forward(10) 75 | bat.right(5) 76 | bat.circle(30, 150) 77 | 78 | #turn 1 79 | bat.left(180) 80 | bat.circle(15, 110) 81 | bat.circle(50, 85) 82 | 83 | #end color filling 84 | bat.end_fill() 85 | 86 | #end the turtle method 87 | turtle.done() -------------------------------------------------------------------------------- /sasuke-mangekyou-sharingan.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | 3 | #eye circle 4 | t.title("Sasuke Mangekyou Sharingan") 5 | t.bgcolor('#bf0404') 6 | t.pensize(10) 7 | t.speed(5) 8 | t.color('black') 9 | t.pu() 10 | t.goto(0,200) 11 | t.pd() 12 | t.fillcolor('black') 13 | t.begin_fill() 14 | t.circle(-200) 15 | t.end_fill() 16 | 17 | # internal red eyes 18 | t.color('black') 19 | t.pu() 20 | t.goto(0,190) 21 | t.pd() 22 | t.seth(-60) 23 | t.fillcolor('red') 24 | t.begin_fill() 25 | t.circle(-380,60) 26 | t.rt(120) 27 | t.circle(-380,60) 28 | t.end_fill() 29 | 30 | t.pu() 31 | t.goto(-164.5,95) 32 | t.pu 33 | t.seth(0) 34 | t.fillcolor('red') 35 | t.begin_fill() 36 | t.circle(-380,60) 37 | t.rt(120) 38 | t.circle(-380,60) 39 | t.end_fill() 40 | 41 | t.color('black') 42 | t.pu() 43 | t.goto(170.5,100) 44 | t.pu 45 | t.seth(-118) 46 | t.fillcolor('red') 47 | t.begin_fill() 48 | t.circle(-380,60) 49 | t.rt(120) 50 | t.circle(-380,60) 51 | t.end_fill() 52 | 53 | # internal Red eyes black borders 54 | t.color('black') 55 | t.pu() 56 | t.goto(0,190) 57 | t.pd() 58 | t.seth(-60) 59 | t.circle(-380,60) 60 | t.rt(120) 61 | t.circle(-380,60) 62 | 63 | t.color('black') 64 | t.goto(-164.5,95) 65 | t.seth(0) 66 | t.circle(-380,60) 67 | t.rt(120) 68 | t.circle(-380,60) 69 | t.end_fill() 70 | t.penup() 71 | 72 | t.goto(170.5,100) 73 | t.seth(-118) 74 | t.pendown() 75 | t.circle(-380,60) 76 | t.rt(120) 77 | t.circle(-380,60) 78 | t.end_fill() 79 | t.penup() 80 | 81 | #last internal eye circle 82 | t.goto(5.0,-14.0) 83 | t.pendown() 84 | t.fillcolor('black') 85 | t.begin_fill() 86 | t.circle(13) 87 | t.end_fill() 88 | 89 | t.done() -------------------------------------------------------------------------------- /panda.py: -------------------------------------------------------------------------------- 1 | # Draw a Panda using Turtle Graphics 2 | # Import turtle package 3 | import turtle, time 4 | 5 | # Creating a turtle object(pen) 6 | pen = turtle.Turtle() 7 | 8 | # Defining method to draw a colored circle 9 | # with a dynamic radius 10 | def ring(col, rad): 11 | 12 | # Set the fill 13 | pen.fillcolor(col) 14 | 15 | # Start filling the color 16 | pen.begin_fill() 17 | 18 | # Draw a circle 19 | pen.circle(rad) 20 | 21 | # Ending the filling of the color 22 | pen.end_fill() 23 | 24 | ##### Draw ears ##### 25 | # Draw first ear 26 | pen.up() 27 | pen.setpos(-35, 95) 28 | pen.down 29 | ring('black', 15) 30 | 31 | # Draw second ear 32 | pen.up() 33 | pen.setpos(35, 95) 34 | pen.down() 35 | ring('black', 15) 36 | 37 | ##### Draw face ##### 38 | pen.up() 39 | pen.setpos(0, 35) 40 | pen.down() 41 | ring('white', 40) 42 | 43 | ##### Draw eyes black ##### 44 | 45 | # Draw first eye 46 | pen.up() 47 | pen.setpos(-18, 75) 48 | pen.down 49 | ring('black', 8) 50 | 51 | # Draw second eye 52 | pen.up() 53 | pen.setpos(18, 75) 54 | pen.down() 55 | ring('black', 8) 56 | 57 | ##### Draw eyes white ##### 58 | 59 | # Draw first eye 60 | pen.up() 61 | pen.setpos(-18, 77) 62 | pen.down() 63 | ring('white', 4) 64 | 65 | # Draw second eye 66 | pen.up() 67 | pen.setpos(18, 77) 68 | pen.down() 69 | ring('white', 4) 70 | 71 | ##### Draw nose ##### 72 | pen.up() 73 | pen.setpos(0, 55) 74 | pen.down 75 | ring('black', 5) 76 | 77 | ##### Draw mouth ##### 78 | pen.up() 79 | pen.setpos(0, 55) 80 | pen.down() 81 | pen.right(90) 82 | pen.circle(5, 180) 83 | pen.up() 84 | pen.setpos(0, 55) 85 | pen.down() 86 | pen.left(360) 87 | pen.circle(5, -180) 88 | pen.hideturtle() 89 | time.sleep(10) -------------------------------------------------------------------------------- /indianflag-logo.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | from turtle import* 3 | 4 | #screen for output 5 | screen = turtle.Screen() 6 | 7 | # Defining a turtle Instance 8 | t = turtle.Turtle() 9 | speed(0) 10 | 11 | # initially penup() 12 | t.penup() 13 | t.goto(-400, 250) 14 | t.pendown() 15 | 16 | # Orange Rectangle 17 | #white rectangle 18 | t.color("orange") 19 | t.begin_fill() 20 | t.forward(800) 21 | t.right(90) 22 | t.forward(167) 23 | t.right(90) 24 | t.forward(800) 25 | t.end_fill() 26 | t.left(90) 27 | t.forward(167) 28 | 29 | # Green Rectangle 30 | t.color("green") 31 | t.begin_fill() 32 | t.forward(167) 33 | t.left(90) 34 | t.forward(800) 35 | t.left(90) 36 | t.forward(167) 37 | t.end_fill() 38 | 39 | # Big Blue Circle 40 | t.penup() 41 | t.goto(70, 0) 42 | t.pendown() 43 | t.color("navy") 44 | t.begin_fill() 45 | t.circle(70) 46 | t.end_fill() 47 | 48 | # Big White Circle 49 | t.penup() 50 | t.goto(60, 0) 51 | t.pendown() 52 | t.color("white") 53 | t.begin_fill() 54 | t.circle(60) 55 | t.end_fill() 56 | 57 | # Mini Blue Circles 58 | t.penup() 59 | t.goto(-57, -8) 60 | t.pendown() 61 | t.color("navy") 62 | for i in range(24): 63 | t.begin_fill() 64 | t.circle(3) 65 | t.end_fill() 66 | t.penup() 67 | t.forward(15) 68 | t.right(15) 69 | t.pendown() 70 | 71 | # Small Blue Circle 72 | t.penup() 73 | t.goto(20, 0) 74 | t.pendown() 75 | t.begin_fill() 76 | t.circle(20) 77 | t.end_fill() 78 | # Spokes 79 | t.penup() 80 | t.goto(0, 0) 81 | t.pendown() 82 | t.pensize(2) 83 | for i in range(24): 84 | t.forward(60) 85 | t.backward(60) 86 | t.left(15) 87 | 88 | #to hold the 89 | #output window 90 | turtle.done() -------------------------------------------------------------------------------- /google-logo.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | t.color('#4285F4','#4285F4') ## RBG value of color 3 | t.pensize(5) 4 | t.speed(3) 5 | 6 | t.forward(120) 7 | t.right(90) 8 | t.circle(-150,50) 9 | t.color('#0F9D58') 10 | t.circle(-150,100) 11 | t.color('#F4B400') 12 | t.circle(-150,60) 13 | t.color('#DB4437','#DB4437') 14 | 15 | t.begin_fill() 16 | t.circle(-150,100) 17 | t.right(90) 18 | t.forward(50) 19 | t.right(90) 20 | t.circle(100,100) 21 | t.right(90) 22 | t.forward(50) 23 | t.end_fill() 24 | 25 | t.begin_fill() 26 | 27 | ## second circle for yellow color 28 | 29 | t.color('#F4B400', "#F4B400") 30 | t.right(180) 31 | t.forward(50) 32 | t.right(90) 33 | 34 | t.circle(100,60) 35 | t.right(90) 36 | t.forward(50) 37 | t.right(90) 38 | t.circle(-150,60) 39 | t.end_fill() 40 | 41 | 42 | # third circle of green color 43 | t.right(90) 44 | t.forward(50) 45 | t.right(90) 46 | t.circle(100,60) 47 | t.color('#0F9D58', '#0F9D58') 48 | t.begin_fill() 49 | t.circle(100,100) 50 | t.right(90) 51 | t.forward(50) 52 | t.right(90) 53 | t.circle(-150, 100) 54 | t.right(90) 55 | t.forward(50) 56 | t.end_fill() 57 | 58 | 59 | ##Draw last circle 60 | 61 | t.right(90) 62 | t.circle(100,100) 63 | t.color('#4285F4','#4285F4') 64 | t.begin_fill() 65 | t.circle(100,25) 66 | t.left(115) 67 | t.forward(65) 68 | t.right(90) 69 | t.forward(42) 70 | t.right(90) 71 | t.forward(124) 72 | t.right(90) 73 | t.circle(-150,50) 74 | t.right(90) 75 | t.forward(50) 76 | 77 | t.end_fill() 78 | t.penup() 79 | ##For display the string statement(name) 80 | t.goto(60,-180) 81 | 82 | 83 | t.color("red") 84 | 85 | t.write("BY SUMALYA CHATTERJEE", font=("courier", 32, "bold")) 86 | t.hideturtle() 87 | 88 | 89 | t.done() -------------------------------------------------------------------------------- /netflix-logo.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | from time import sleep 3 | 4 | # Part 1 : Initialize the module 5 | t = turtle.Turtle() 6 | t.speed(4) 7 | turtle.bgcolor("white") 8 | t.color("black") 9 | turtle.title('Netflix Logo') 10 | 11 | # Part 2 : Drawing the black background 12 | t.up() 13 | t.goto(-80, 50) 14 | t.down() 15 | t.fillcolor("black") 16 | t.begin_fill() 17 | 18 | t.forward(200) 19 | t.setheading(270) 20 | s = 360 21 | for i in range(9): 22 | s = s - 10 23 | t.setheading(s) 24 | t.forward(10) 25 | 26 | t.forward(180) 27 | s = 270 28 | for i in range(9): 29 | s = s - 10 30 | t.setheading(s) 31 | t.forward(10) 32 | 33 | t.forward(200) 34 | s = 180 35 | for i in range(9): 36 | s = s - 10 37 | t.setheading(s) 38 | t.forward(10) 39 | 40 | t.forward(180) 41 | s = 90 42 | for i in range(9): 43 | s = s - 10 44 | t.setheading(s) 45 | t.forward(10) 46 | t.forward(30) 47 | t.end_fill() 48 | 49 | # Part 3 : Drawing the N shape 50 | t.up() 51 | t.color("black") 52 | t.setheading(270) 53 | t.forward(240) 54 | t.setheading(0) 55 | t.down() 56 | t.color("red") 57 | t.fillcolor("#E50914") 58 | t.begin_fill() 59 | t.forward(30) 60 | t.setheading(90) 61 | t.forward(180) 62 | t.setheading(180) 63 | t.forward(30) 64 | t.setheading(270) 65 | t.forward(180) 66 | t.end_fill() 67 | t.setheading(0) 68 | t.up() 69 | t.forward(75) 70 | t.down() 71 | t.color("red") 72 | t.fillcolor("#E50914") 73 | t.begin_fill() 74 | t.forward(30) 75 | t.setheading(90) 76 | t.forward(180) 77 | t.setheading(180) 78 | t.forward(30) 79 | t.setheading(270) 80 | t.forward(180) 81 | t.end_fill() 82 | t.color("red") 83 | t.fillcolor("red") 84 | t.begin_fill() 85 | t.setheading(113) 86 | t.forward(195) 87 | t.setheading(0) 88 | t.forward(31) 89 | t.setheading(293) 90 | t.forward(196) 91 | t.end_fill() 92 | t.hideturtle() 93 | 94 | sleep(10) -------------------------------------------------------------------------------- /ironman.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | HULK1 = [[(-40, 120), (-70, 260), (-130, 230), (-170, 200), (-170, 100), (-160, 40), (-170, 10), (-150, -10), (-140, 10), 4 | (-40, -20), (0, -20)], 5 | [(0, -20), (40, -20), (140, 10), (150, -10), (170, 10), (160, 40), (170, 100), (170, 200), (130, 230), (70, 260), 6 | (40, 120), (0, 120)]] 7 | HULK2 = [[(-40, -30), (-50, -40), (-100, -46), (-130, -40), (-176, 0), (-186, -30), (-186, -40), (-120, -170), (-110, -210), 8 | (-80, -230), (-64, -210), (0, -210)], 9 | [(0, -210), (64, -210), (80, -230), (110, -210), (120, -170), (186, -40), (186, -30), (176, 0), (130, -40), 10 | (100, -46), (50, -40), (40, -30), (0, -30)]] 11 | HULK3 = [[(-60, -220), (-80, -240), (-110, -220), (-120, -250), (-90, -280), (-60, -260), (-30, -260), (-20, -250), 12 | (0, -250)], 13 | [(0, -250), (20, -250), (30, -260), (60, -260), (90, -280), (120, -250), (110, -220), (80, -240), (60, -220), 14 | (0, -220)]] 15 | 16 | turtle.hideturtle() 17 | turtle.bgcolor('#ba161e') # Dark Red 18 | turtle.setup(500, 600) 19 | turtle.title("I AM IRONMAN, Coded by Sumalya") 20 | HULK1Goto = (0, 120) 21 | HULK2Goto = (0, -30) 22 | HULK3Goto = (0, -220) 23 | turtle.speed(2) 24 | 25 | 26 | def logo(a, b): 27 | turtle.penup() 28 | turtle.goto(b) 29 | turtle.pendown() 30 | turtle.color('#fab104') # Light Yellow 31 | turtle.begin_fill() 32 | 33 | for i in range(len(a[0])): 34 | x, y = a[0][i] 35 | turtle.goto(x, y) 36 | 37 | for i in range(len(a[1])): 38 | x, y = a[1][i] 39 | turtle.goto(x, y) 40 | turtle.end_fill() 41 | 42 | 43 | logo(HULK1, HULK1Goto) 44 | logo(HULK2, HULK2Goto) 45 | logo(HULK3, HULK3Goto) 46 | 47 | turtle.hideturtle() 48 | turtle.done() -------------------------------------------------------------------------------- /happy-halloween.py: -------------------------------------------------------------------------------- 1 | # importing libraries 2 | import turtle 3 | # initalizing a variable for turtle 4 | t = turtle.Turtle() 5 | # creating turtle screen 6 | screen = turtle.Screen() 7 | # setting up the screen size of canvas 8 | screen.setup(1200, 600) 9 | # changing the color of background to black 10 | screen.bgcolor('black') 11 | t.pencolor("red") 12 | t.penup() 13 | t.goto(-500, -20) 14 | # defining font size, color and type 15 | t.write('Happy Halloween', font=("Courier", 80, "italic")) 16 | # from here we are adding colourful circles on our canvas 17 | # deciding the color for circle 18 | t.fillcolor("blue") 19 | # start the filling color 20 | t.begin_fill() 21 | # radius of circle 22 | r = 10 23 | t.goto(100, 100) 24 | t.circle(r) 25 | # end filling the colour 26 | t.end_fill() 27 | 28 | # making different circles and different positions for different colours 29 | t.fillcolor("white") 30 | t.begin_fill() 31 | t.goto(-100, -100) 32 | t.circle(r) 33 | t.end_fill() 34 | 35 | t.fillcolor("green") 36 | t.begin_fill() 37 | t.goto(-200, -200) 38 | t.circle(r) 39 | t.end_fill() 40 | 41 | t.fillcolor("orange") 42 | t.begin_fill() 43 | t.goto(100, -100) 44 | t.circle(r) 45 | t.end_fill() 46 | 47 | t.fillcolor("yellow") 48 | t.begin_fill() 49 | t.goto(-100, 100) 50 | t.circle(r) 51 | t.end_fill() 52 | 53 | t.fillcolor("pink") 54 | t.begin_fill() 55 | t.goto(-250, -150) 56 | t.circle(r) 57 | t.end_fill() 58 | 59 | t.fillcolor("white") 60 | t.begin_fill() 61 | t.goto(-250, 150) 62 | t.circle(r) 63 | t.end_fill() 64 | 65 | t.fillcolor("blue") 66 | t.begin_fill() 67 | t.goto(250, -150) 68 | t.circle(r) 69 | t.end_fill() 70 | 71 | t.fillcolor("yellow") 72 | t.begin_fill() 73 | t.goto(-300, -200) 74 | t.circle(r) 75 | t.end_fill() 76 | 77 | # holding the screen 78 | screen.mainloop() 79 | -------------------------------------------------------------------------------- /among-us.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | color1 = 'yellow' 4 | color2 = 'red' 5 | color3 = 'skyblue' 6 | color4 = 'black' 7 | 8 | s = turtle.getscreen() 9 | t = turtle.Turtle() 10 | 11 | def hulk(): 12 | t.pensize(20) 13 | 14 | t.fillcolor(color1) 15 | t.begin_fill() 16 | 17 | t.right(90) 18 | t.forward(50) 19 | t.right(180) 20 | t.circle(40, -180) 21 | t.right(180) 22 | t.forward(200) 23 | 24 | t.right(180) 25 | t.circle(100, -180) 26 | 27 | t.backward(20) 28 | t.left(15) 29 | t.circle(500, -20) 30 | t.backward(20) 31 | 32 | t.circle(40, -180) 33 | t.left(7) 34 | t.backward(50) 35 | 36 | t.up() 37 | t.left(90) 38 | t.forward(10) 39 | t.right(90) 40 | t.down() 41 | 42 | t.right(240) 43 | t.circle(50, -70) 44 | 45 | t.end_fill() 46 | 47 | 48 | def glass(): 49 | t.up() 50 | 51 | t.right(230) 52 | t.forward(100) 53 | t.left(90) 54 | t.forward(20) 55 | t.right(90) 56 | 57 | t.down() 58 | t.fillcolor(color3) 59 | t.begin_fill() 60 | 61 | t.right(150) 62 | t.circle(90, -55) 63 | 64 | t.right(180) 65 | t.forward(1) 66 | t.right(180) 67 | t.circle(10, -65) 68 | t.right(180) 69 | t.forward(110) 70 | t.right(180) 71 | 72 | t.circle(50, -190) 73 | t.right(170) 74 | t.forward(80) 75 | 76 | t.right(180) 77 | t.circle(45, -30) 78 | 79 | t.end_fill() 80 | 81 | def bagpack(): 82 | t.up() 83 | t.right(60) 84 | t.forward(100) 85 | t.right(90) 86 | t.forward(75) 87 | 88 | t.fillcolor(color1) 89 | t.begin_fill() 90 | 91 | t.down() 92 | t.forward(30) 93 | t.right(255) 94 | 95 | t.circle(300, -30) 96 | t.right(260) 97 | t.forward(30) 98 | 99 | t.end_fill() 100 | 101 | 102 | hulk() 103 | glass() 104 | bagpack() 105 | 106 | turtle.done() -------------------------------------------------------------------------------- /Five Shapes.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import random 3 | 4 | wn = turtle.Screen() 5 | wn.bgcolor("black") 6 | astroid = turtle.Turtle() 7 | astroid.speed(0) 8 | triad = turtle.Turtle() 9 | triad.speed(0) 10 | triad.up() 11 | triad.goto(-120, 120) 12 | triad.down() 13 | squad = turtle.Turtle() 14 | squad.speed(0) 15 | squad.up() 16 | squad.goto(120, 120) 17 | squad.down() 18 | pentago = turtle.Turtle() 19 | pentago.speed(0) 20 | pentago.up() 21 | pentago.goto(-120, -120) 22 | pentago.down() 23 | octago = turtle.Turtle() 24 | octago.speed(0) 25 | octago.up() 26 | octago.goto(120, -120) 27 | octago.down() 28 | colors = ["red", "gold", "blue", "green", "white", "cyan", "pink"] 29 | 30 | for i in range(50): 31 | triad.color(random.choice(colors)) 32 | triad.forward(i * 3) 33 | triad.left(120) 34 | 35 | for i in range(50): 36 | squad.color(random.choice(colors)) 37 | squad.forward(i * 2) 38 | squad.left(90) 39 | 40 | for i in range(50): 41 | pentago.color(random.choice(colors)) 42 | pentago.forward(i * 2) 43 | pentago.left(72) 44 | 45 | for i in range(75): 46 | octago.color(random.choice(colors)) 47 | octago.forward(i) 48 | octago.left(60) 49 | 50 | for i in range(50): 51 | astroid.color(random.choice(colors)) 52 | astroid.forward(i * 3) 53 | astroid.left(144) 54 | 55 | triad.up() 56 | triad.goto(-110, 200) 57 | triad.down() 58 | triad.write("Triad") 59 | triad.hideturtle() 60 | 61 | squad.up() 62 | squad.goto(120, 180) 63 | squad.down() 64 | squad.write("Squad") 65 | squad.hideturtle() 66 | 67 | pentago.up() 68 | pentago.goto(-140, -20) 69 | pentago.write("Pentago") 70 | pentago.hideturtle() 71 | 72 | octago.up() 73 | octago.goto(120, -40) 74 | octago.down() 75 | octago.write("Hex") 76 | octago.hideturtle() 77 | 78 | astroid.up() 79 | astroid.goto(0, 60) 80 | astroid.down() 81 | astroid.write("Astroid") 82 | astroid.hideturtle() 83 | 84 | turtle.done() -------------------------------------------------------------------------------- /python-logo.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | t = turtle.Turtle() 4 | s = turtle.Screen() 5 | s.bgcolor("black") 6 | t.speed(10) 7 | t.pensize(2) 8 | t.pencolor("white") 9 | 10 | 11 | 12 | def s_curve(): 13 | for i in range(90): 14 | t.left(1) 15 | t.forward(1) 16 | 17 | def r_curve(): 18 | for i in range(90): 19 | t.right(1) 20 | t.forward(1) 21 | 22 | def l_curve(): 23 | s_curve() 24 | t.forward(80) 25 | s_curve() 26 | 27 | def l_curve1(): 28 | s_curve() 29 | t.forward(90) 30 | s_curve() 31 | 32 | def half(): 33 | t.forward(50) 34 | s_curve() 35 | t.forward(90) 36 | l_curve() 37 | t.forward(40) 38 | t.left(90) 39 | t.forward(80) 40 | t.right(90) 41 | t.forward(10) 42 | t.right(90) 43 | t.forward(120) #on test 44 | l_curve1() 45 | t.forward(30) 46 | t.left(90) 47 | t.forward(50) 48 | r_curve() 49 | t.forward(40) 50 | t.end_fill() 51 | 52 | def get_pos(): 53 | t.penup() 54 | t.forward(20) 55 | t.right(90) 56 | t.forward(10) 57 | t.right(90) 58 | t.pendown() 59 | 60 | def eye(): 61 | t.penup() 62 | t.right(90) 63 | t.forward(160) 64 | t.left(90) 65 | t.forward(70) 66 | t.pencolor("black") 67 | t.dot(35) 68 | 69 | def sec_dot(): 70 | t.left(90) 71 | t.penup() 72 | t.forward(310) 73 | t.left(90) 74 | t.forward(120) 75 | t.pendown() 76 | 77 | t.dot(35) 78 | 79 | 80 | 81 | 82 | t.fillcolor("#306998") 83 | t.begin_fill() 84 | half() 85 | t.end_fill() 86 | get_pos() 87 | t.fillcolor("#FFD43B") 88 | t.begin_fill() 89 | half() 90 | t.end_fill() 91 | 92 | eye() 93 | sec_dot() 94 | 95 | 96 | 97 | def pause(): 98 | t.speed(2) 99 | for i in range(100): 100 | t.left(90) 101 | pause() -------------------------------------------------------------------------------- /happy-new-year.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | screen = turtle.Screen() 3 | screen.setup(width=1.0, height=1.0) 4 | turtle.bgcolor('black') 5 | tr = turtle.Turtle() 6 | tr.speed("fastest") 7 | tr.up() 8 | # left decoration 9 | for i in range(10): 10 | for i in range(2): 11 | tr.pensize(7) 12 | tr.goto(-500, 0) 13 | tr.down() 14 | tr.color("purple") 15 | tr.forward(100) 16 | tr.circle(5, steps=4) 17 | tr.right(60) 18 | tr.color("violet") 19 | tr.forward(50) 20 | tr.right(120) 21 | tr.right(30) 22 | tr.up() 23 | # right decoration 24 | for i in range(10): 25 | for i in range(2): 26 | tr.pensize(7) 27 | tr.goto(470, 0) 28 | tr.down() 29 | tr.color("red") 30 | tr.forward(100) 31 | tr.circle(5, steps=4) 32 | tr.right(60) 33 | tr.color("crimson") 34 | tr.forward(50) 35 | tr.right(120) 36 | tr.right(30) 37 | tr.up() 38 | # top decoration 39 | for i in range(10): 40 | for i in range(2): 41 | tr.pensize(7) 42 | tr.goto(20, 265) 43 | tr.down() 44 | tr.color("forest green") 45 | tr.forward(100) 46 | tr.circle(5, steps=4) 47 | tr.right(60) 48 | tr.color("lime") 49 | tr.forward(50) 50 | tr.right(120) 51 | tr.right(30) 52 | tr.up() 53 | # bottom decoration 54 | for i in range(10): 55 | for i in range(2): 56 | tr.pensize(7) 57 | tr.goto(20, -220) 58 | tr.down() 59 | tr.color("dark turquoise") 60 | tr.forward(100) 61 | tr.circle(5, steps=4) 62 | tr.right(60) 63 | tr.color("cyan") 64 | tr.forward(50) 65 | tr.right(120) 66 | tr.right(30) 67 | 68 | 69 | turtle.up() 70 | turtle.color('red') 71 | turtle.goto(-320, 40) 72 | turtle.write("Happy ", font=(None, 60)) 73 | turtle.goto(-60, 40) 74 | turtle.color('deep pink') 75 | turtle.write("New", font=(None, 60)) 76 | turtle.goto(145, 40) 77 | turtle.color('blue') 78 | turtle.write("Year", font=(None, 60)) 79 | turtle.goto(-74, -60) 80 | turtle.color('green') 81 | turtle.write("2023!", font=(None, 60)) 82 | turtle.done() -------------------------------------------------------------------------------- /avenger-logo.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | 4 | def draw_circle(pen): 5 | # outer circle 6 | pen.setposition(0, -280) 7 | pen.pendown() 8 | pen.begin_fill() 9 | pen.color('red') 10 | pen.pencolor('white') 11 | pen.circle(300) 12 | pen.end_fill() 13 | pen.penup() 14 | 15 | 16 | def draw_circle2(pen): 17 | # inner circle 18 | pen.pensize(2) 19 | pen.setposition(0, -230) 20 | pen.pendown() 21 | pen.begin_fill() 22 | pen.color('black') 23 | pen.circle(250) 24 | pen.end_fill() 25 | pen.penup() 26 | 27 | 28 | def draw_A(pen): 29 | # drawing ‘A’ 30 | pen.setposition(30, -110) 31 | pen.pendown() 32 | pen.begin_fill() 33 | pen.color('red') 34 | pen.pensize(10) 35 | pen.pencolor('white') 36 | pen.forward(23) 37 | pen.backward(123) 38 | pen.left(60) 39 | pen.backward(220) 40 | pen.right(60) 41 | pen.backward(100) 42 | pen.right(117) 43 | pen.backward(710) 44 | pen.right(63) 45 | pen.backward(110) 46 | pen.right(90) 47 | pen.backward(510) 48 | pen.right(90) 49 | pen.backward(100) 50 | pen.right(90) 51 | pen.backward(70) 52 | pen.end_fill() 53 | pen.penup() 54 | 55 | 56 | def draw_triangle(pen): 57 | # Triangle shape in ‘A’ to make it look like 2d 58 | pen.pensize(10) 59 | pen.setposition(53, -40) 60 | pen.pendown() 61 | pen.begin_fill() 62 | pen.color('black') 63 | pen.pencolor('white') 64 | pen.right(90) 65 | pen.forward(100) 66 | pen.right(115) 67 | pen.forward(250) 68 | pen.right(157) 69 | pen.forward(227) 70 | pen.end_fill() 71 | 72 | 73 | def draw_arrow(pen): 74 | # arrow 75 | pen.backward(80) 76 | pen.left(42) 77 | pen.forward(147) 78 | pen.right(83) 79 | pen.forward(140) 80 | 81 | 82 | if __name__ == '__main__': 83 | win = turtle.Screen() 84 | win.bgcolor('black') 85 | 86 | avengers = turtle.Turtle() 87 | avengers.speed(10) 88 | avengers.pensize(10) 89 | avengers.penup() 90 | 91 | draw_circle(avengers) 92 | draw_circle2(avengers) 93 | draw_A(avengers) 94 | draw_triangle(avengers) 95 | draw_arrow(avengers) 96 | avengers.penup() 97 | 98 | avengers.setposition(300,300) 99 | avengers.pencolor("red") 100 | 101 | avengers.write("Code by Sumalya Chatterjee") 102 | avengers.hideturtle() 103 | turtle.done() -------------------------------------------------------------------------------- /dell.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | t=turtle.Turtle() 4 | turtle.bgcolor('black') 5 | t.pensize(15) 6 | t.color("#3287c1","#3287c1") 7 | t.penup() 8 | t.goto(20,-200) 9 | t.pendown() 10 | t.circle(180) 11 | t.penup() 12 | 13 | 14 | #Draw the "D" of the DELL logo 15 | t.pensize(2) 16 | t.goto(-130,-70) 17 | t.pendown() 18 | t.setheading(90) 19 | t.forward(90) 20 | t.right(90) 21 | t.forward(50) 22 | t.penup() 23 | t.goto(-130,-70) 24 | t.setheading(0) 25 | t.pendown() 26 | t.forward(50) 27 | t.left(10) 28 | t.circle(46,165) 29 | t.penup() 30 | 31 | t.color("#3287c1") 32 | t.goto(-130,-70) 33 | t.setheading(0) 34 | t.pendown() 35 | t.begin_fill() 36 | 37 | t.forward(20) 38 | t.left(90) 39 | t.forward(90) 40 | t.left(90) 41 | t.forward(20) 42 | t.end_fill() 43 | t.backward(20) 44 | t.left(90) 45 | t.forward(17) 46 | t.setheading(0) 47 | t.begin_fill() 48 | t.forward(30) 49 | t.right(25) 50 | t.circle(-30,130) 51 | t.setheading(180) 52 | t.forward(30) 53 | t.left(90) 54 | t.forward(17) 55 | t.setheading(0) 56 | t.forward(30) 57 | t.left(10) 58 | t.circle(45,165) 59 | t.setheading(180) 60 | t.forward(47) 61 | t.end_fill() 62 | t.penup() 63 | 64 | #Draw the 'E' of the DELL logo 65 | t.goto(-45,-15) 66 | t.pendown() 67 | t.setheading(0) 68 | t.left(35) 69 | t.begin_fill() 70 | t.forward(65) 71 | t.right(90) 72 | t.forward(18) 73 | t.right(90) 74 | t.forward(50) 75 | t.left(90) 76 | t.forward(10) 77 | t.left(90) 78 | t.forward(50) 79 | t.right(90) 80 | t.forward(18) 81 | t.right(90) 82 | t.forward(50) 83 | t.left(90) 84 | t.forward(10) 85 | t.left(90) 86 | t.forward(50) 87 | t.right(90) 88 | t.forward(18) 89 | t.right(90) 90 | t.forward(65) 91 | t.right(85) 92 | t.forward(65) 93 | t.penup() 94 | t.end_fill() 95 | 96 | #Draw the 'L' of the DELL logo 97 | t.goto(40,-70) 98 | t.setheading(90) 99 | t.pendown() 100 | t.begin_fill() 101 | t.forward(90) 102 | t.right(90) 103 | t.forward(20) 104 | t.right(90) 105 | t.forward(70) 106 | t.left(90) 107 | t.forward(40) 108 | t.right(90) 109 | t.forward(20) 110 | t.right(90) 111 | t.forward(60) 112 | t.end_fill() 113 | t.penup() 114 | 115 | #Draw the 'l' of the DELL Logo 116 | t.goto(110,-70) 117 | t.setheading(90) 118 | t.pendown() 119 | t.begin_fill() 120 | t.forward(90) 121 | t.right(90) 122 | t.forward(20) 123 | t.right(90) 124 | t.forward(70) 125 | t.left(90) 126 | t.forward(40) 127 | t.right(90) 128 | t.forward(20) 129 | t.right(90) 130 | t.forward(60) 131 | t.end_fill() 132 | t.penup() 133 | t.hideturtle() 134 | 135 | turtle.done() -------------------------------------------------------------------------------- /tesla-logo.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | logo = ''' 4 | Author :: Sumalya Chatterjee 5 | Github :: https://github.com/R3DHULK/ 6 | Youtube:: https://youtube.com/@sumalya 7 | Website::https://r3dhulk.github.io/ 8 | ''' 9 | print('logo') 10 | t=turtle.Turtle() 11 | 12 | t.getscreen().bgcolor("black") 13 | t.pencolor("white") 14 | t.speed(4) 15 | 16 | t.color("#E82127") 17 | t.penup() 18 | t.goto(-160,160) 19 | t.pendown() 20 | 21 | t.begin_fill() 22 | t.left(18) 23 | t.circle(-500,40) 24 | t.right(90) 25 | t.forward(17) 26 | 27 | t.right(89.5) 28 | t.circle(500,39) 29 | t.right(90) 30 | t.forward(17) 31 | t.end_fill() 32 | 33 | t.penup() 34 | t.goto(-155,133) 35 | t.pendown() 36 | 37 | t.begin_fill() 38 | t.right(90.5) 39 | t.circle(-500,38) 40 | t.right(70) 41 | t.circle(-30,80) 42 | t.left(90) 43 | t.circle(-20,-70) 44 | t.right(10) 45 | t.circle(-300,-15) 46 | t.right(93) 47 | t.forward(280) 48 | t.right(160) 49 | t.forward(280) 50 | t.left(80) 51 | t.circle(300,15) 52 | t.circle(20,70) 53 | t.left(80) 54 | t.circle(30,-80) 55 | t.end_fill() 56 | 57 | t.penup() 58 | t.goto(-20,155) 59 | t.pendown() 60 | t.pencolor("black") 61 | t.color("black") 62 | t.begin_fill() 63 | t.left(30) 64 | t.forward(60) 65 | t.left(130) 66 | t.forward(65) 67 | t.end_fill() 68 | 69 | # T letter 70 | t.pencolor("#E82127") 71 | t.penup() 72 | t.goto(-200,-180) 73 | t.pendown() 74 | t.right(66) 75 | 76 | t.pensize(15) 77 | t.forward(60) 78 | t.back(30) 79 | t.right(90) 80 | t.forward(70) 81 | 82 | #E Letter 83 | t.penup() 84 | t.goto(-115,-180) 85 | t.pendown() 86 | t.left(90) 87 | t.forward(60) 88 | t.penup() 89 | t.goto(-115,-215) 90 | t.pendown() 91 | t.forward(60) 92 | t.penup() 93 | t.goto(-115,-250) 94 | t.pendown() 95 | t.forward(60) 96 | 97 | # S letter 98 | t.penup() 99 | t.goto(-20,-180) 100 | t.pendown() 101 | t.forward(60) 102 | t.backward(60) 103 | t.right(90) 104 | t.forward(34) 105 | t.left(90) 106 | t.forward(60) 107 | t.right(90) 108 | t.forward(34) 109 | t.right(90) 110 | t.forward(60) 111 | 112 | # L letter 113 | t.penup() 114 | t.goto(70,-180) 115 | t.pendown() 116 | t.left(90) 117 | t.forward(70) 118 | t.left(90) 119 | t.forward(60) 120 | 121 | # A letter 122 | t.penup() 123 | t.goto(155,-180) 124 | t.pendown() 125 | t.forward(60) 126 | 127 | t.penup() 128 | t.goto(155,-250) 129 | t.pendown() 130 | t.left(90) 131 | t.forward(32.5) 132 | t.right(90) 133 | t.forward(60) 134 | t.right(90) 135 | t.forward(32.5) 136 | 137 | t.hideturtle() 138 | turtle.done() -------------------------------------------------------------------------------- /batman2.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import math 3 | 4 | hulk= turtle.Turtle() 5 | hulk.speed(500) 6 | 7 | window = turtle.Screen() 8 | window.bgcolor("#000000") 9 | hulk.color("yellow") 10 | 11 | avenger = 20 12 | 13 | hulk.left(90) 14 | hulk.penup() 15 | hulk.goto(-7 * avenger, 0) 16 | hulk.pendown() 17 | 18 | for a in range(-7 * avenger, -3 * avenger, 1): 19 | x = a / avenger 20 | rel = math.fabs(x) 21 | y = 1.5 * math.sqrt((-math.fabs(rel - 1)) * math.fabs(3 - rel) / ((rel - 1) * (3 - rel))) * ( 22 | 1 + math.fabs(rel - 3) / (rel - 3)) * math.sqrt(1 - (x / 7) ** 2) + ( 23 | 4.5 + 0.75 * (math.fabs(x - 0.5) + math.fabs(x + 0.5)) - 2.75 * ( 24 | math.fabs(x - 0.75) + math.fabs(x + 0.75))) * (1 + math.fabs(1 - rel) / (1 - rel)) 25 | hulk.goto(a, y * avenger) 26 | 27 | for a in range(-3 * avenger, -1 * avenger - 1, 1): 28 | x = a / avenger 29 | rel = math.fabs(x) 30 | y = (2.71052 + 1.5 - 0.5 * rel - 1.35526 * math.sqrt(4 - (rel - 1) ** 2)) * math.sqrt( 31 | math.fabs(rel - 1) / (rel - 1)) 32 | hulk.goto(a, y * avenger) 33 | 34 | hulk.goto(-1 * avenger, 3 * avenger) 35 | hulk.goto(int(-0.5 * avenger), int(2.2 * avenger)) 36 | hulk.goto(int(0.5 * avenger), int(2.2 * avenger)) 37 | hulk.goto(1 * avenger, 3 * avenger) 38 | print("Batman Logo with Python Turtle") 39 | for a in range(1 * avenger + 1, 3 * avenger + 1, 1): 40 | x = a / avenger 41 | rel = math.fabs(x) 42 | y = (2.71052 + 1.5 - 0.5 * rel - 1.35526 * math.sqrt(4 - (rel - 1) ** 2)) * math.sqrt( 43 | math.fabs(rel - 1) / (rel - 1)) 44 | hulk.goto(a, y * avenger) 45 | 46 | for a in range(3 * avenger + 1, 7 * avenger + 1, 1): 47 | x = a / avenger 48 | rel = math.fabs(x) 49 | y = 1.5 * math.sqrt((-math.fabs(rel - 1)) * math.fabs(3 - rel) / ((rel - 1) * (3 - rel))) * ( 50 | 1 + math.fabs(rel - 3) / (rel - 3)) * math.sqrt(1 - (x / 7) ** 2) + ( 51 | 4.5 + 0.75 * (math.fabs(x - 0.5) + math.fabs(x + 0.5)) - 2.75 * ( 52 | math.fabs(x - 0.75) + math.fabs(x + 0.75))) * (1 + math.fabs(1 - rel) / (1 - rel)) 53 | hulk.goto(a, y * avenger) 54 | 55 | for a in range(7 * avenger, 4 * avenger, -1): 56 | x = a / avenger 57 | rel = math.fabs(x) 58 | y = (-3) * math.sqrt(1 - (x / 7) ** 2) * math.sqrt(math.fabs(rel - 4) / (rel - 4)) 59 | hulk.goto(a, y * avenger) 60 | 61 | for a in range(4 * avenger, -4 * avenger, -1): 62 | x = a / avenger 63 | rel = math.fabs(x) 64 | y = math.fabs(x / 2) - 0.0913722 * x ** 2 - 3 + math.sqrt(1 - (math.fabs(rel - 2) - 1) ** 2) 65 | hulk.goto(a, y * avenger) 66 | 67 | for a in range(-4 * avenger - 1, -7 * avenger - 1, -1): 68 | x = a / avenger 69 | rel = math.fabs(x) 70 | y = (-3) * math.sqrt(1 - (x / 7) ** 2) * math.sqrt(math.fabs(rel - 4) / (rel - 4)) 71 | hulk.goto(a, y * avenger) 72 | 73 | hulk.penup() 74 | hulk.goto(300, 300) 75 | turtle.done() -------------------------------------------------------------------------------- /halloween.py: -------------------------------------------------------------------------------- 1 | # importing libraries 2 | from turtle import * 3 | import turtle 4 | # initalizing a variable for turtle 5 | t = turtle.Turtle() 6 | # creating turtle screen 7 | screen = turtle.Screen() 8 | # setting up the screen size of canvas 9 | screen.setup(900, 650) 10 | # changing the color of background to black 11 | screen.bgcolor('black') 12 | # defining speed of turtle 13 | t.speed(50) 14 | t.hideturtle() 15 | # deciding the color for circle 16 | t.fillcolor("#DC5F00") 17 | # start the filling color 18 | t.begin_fill() 19 | t.up() 20 | # radius of circle 21 | r = 180 22 | t.goto(0, -240) 23 | t.circle(r) 24 | # end filling the colour 25 | t.end_fill() 26 | # drawing triangle for eyes 27 | # left eye 28 | t.up() 29 | t.setpos(-140, -45) 30 | t.fillcolor("gold") 31 | t.begin_fill() 32 | t.forward(100) # draw base 33 | t.left(120) 34 | t.forward(100) # draw second side 35 | t.left(120) 36 | t.forward(100) # draw third side 37 | t.end_fill() 38 | # right eye 39 | t.up() 40 | t.setpos(90, 40) 41 | t.fillcolor("gold") 42 | t.begin_fill() 43 | t.forward(100) # draw base 44 | t.left(120) 45 | t.forward(100) # draw second side 46 | t.left(120) 47 | t.forward(100) # draw third side 48 | t.end_fill() 49 | # drawing inverted triangle for nose 50 | t.up() 51 | t.setpos(0, -110) 52 | t.fillcolor("gold") 53 | t.begin_fill() 54 | t.forward(40) 55 | t.right(120) 56 | t.forward(40) 57 | t.right(120) 58 | t.forward(40) 59 | t.end_fill() 60 | # drawing triangle for tooth of pumpkin🎃 61 | # triangle 1 62 | t.up() 63 | t.setpos(-60, -120) 64 | t.fillcolor("gold") 65 | t.begin_fill() 66 | t.forward(50) 67 | t.right(120) 68 | t.forward(50) 69 | t.right(120) 70 | t.forward(50) 71 | t.end_fill() 72 | # triangle 2 73 | t.up() 74 | t.setpos(-60, -120) 75 | t.fillcolor("gold") 76 | t.begin_fill() 77 | t.forward(50) # draw base 78 | t.right(120) 79 | t.forward(50) 80 | t.right(120) 81 | t.forward(50) 82 | t.end_fill() 83 | # trinagle 3 84 | t.up() 85 | t.setpos(14, -163) 86 | t.fillcolor("gold") 87 | t.begin_fill() 88 | t.forward(50) # draw base 89 | t.right(120) 90 | t.forward(50) 91 | t.right(120) 92 | t.forward(50) 93 | t.end_fill() 94 | # trinagle 4 95 | t.up() 96 | t.setpos(90, -120) 97 | t.fillcolor("gold") 98 | t.begin_fill() 99 | t.forward(50) # draw base 100 | t.right(120) 101 | t.forward(50) 102 | t.right(120) 103 | t.forward(50) 104 | t.end_fill() 105 | # drawing green part of pumpkin 106 | t.fillcolor("green") 107 | t.begin_fill() 108 | t.goto(-20, 110) 109 | # drawing first side 110 | t.forward(40) # Forward turtle by 40 units 111 | t.left(90) # Turn turtle by 90 degree 112 | # drawing second side 113 | t.forward(60) # Forward turtle by 60 units 114 | t.left(90) # Turn turtle by 90 degree 115 | # drawing third side 116 | t.forward(40) # Forward turtle by 40 units 117 | t.left(90) # Turn turtle by 90 degree 118 | # drawing fourth side 119 | t.forward(60) # Forward turtle by 60 units 120 | t.left(90) # Turn turtle by 90 degree 121 | t.end_fill() 122 | # writing happy halloween on canvas 123 | t.goto(-250, -290) 124 | t.pencolor("red") 125 | t.write('Happy Halloween', font=("Courier", 14, "italic")) 126 | # holding the screen to display 127 | screen.mainloop() -------------------------------------------------------------------------------- /usa-flag.py: -------------------------------------------------------------------------------- 1 | #import the time and turtle module 2 | import turtle 3 | import time 4 | 5 | # create a screen 6 | scr = turtle.getscreen() 7 | scr.title("Flag of America") 8 | scr.bgcolor("white") 9 | 10 | #Set the turtle object and speed of the turtle 11 | 12 | t = turtle.Turtle() 13 | t.speed(20) 14 | t.penup() 15 | 16 | # flag height and width 17 | flag_ht = 250 18 | flag_wth = 475 19 | 20 | # starting points of the flag 21 | x1 = -250 22 | y1 = 120 23 | 24 | # red and white stripes (total 13 stripes in flag) 25 | stripe_ht = flag_ht/13 26 | stripe_wdt = flag_wth 27 | #star size 28 | star_size = 12 29 | 30 | 31 | def draw_rectangle(x, y, height, width, color): 32 | t.goto(x,y) 33 | t.pendown() 34 | t.color(color) 35 | t.begin_fill() 36 | t.forward(width) 37 | t.right(90) 38 | t.forward(height) 39 | t.right(90) 40 | t.forward(width) 41 | t.right(90) 42 | t.forward(height) 43 | t.right(90) 44 | t.end_fill() 45 | t.penup() 46 | 47 | def star_shape(x,y,color,length) : 48 | t.goto(x,y) 49 | t.setheading(0) 50 | t.pendown() 51 | t.begin_fill() 52 | t.color(color) 53 | for turn in range(0,5) : 54 | t.forward(length) 55 | t.right(144) 56 | t.forward(length) 57 | t.right(144) 58 | t.end_fill() 59 | t.penup() 60 | 61 | 62 | # function to create stripes of flag 63 | def draw_stripes(): 64 | x = x1 65 | y = y1 66 | # draw 6 red and 7 white strips 67 | for stripe in range(0,6): 68 | for color in ["red", "white"]: 69 | draw_rectangle(x, y, stripe_ht, stripe_wdt, color) 70 | # decrease value of y by stripe_height 71 | y = y - stripe_ht 72 | 73 | # create last red stripe 74 | draw_rectangle(x, y, stripe_ht, stripe_wdt, 'red') 75 | y = y - stripe_ht 76 | 77 | 78 | # this function create navy color square 79 | def draw_square(): 80 | square_ht = (7/13) * flag_ht 81 | square_wdt = (0.76) * flag_ht 82 | draw_rectangle(x1, y1, square_ht, square_wdt, 'navy') 83 | 84 | #defining a function for drawing a 6 row star 85 | def stars1(): 86 | dist_of_stars = 30 87 | dist_bet_lines = stripe_ht + 6 88 | y = 112 89 | # create 5 rows of stars 90 | for row in range(0,5) : 91 | x = -234 92 | # create 6 stars in each row 93 | for star in range (0,6) : 94 | star_shape(x, y, 'white', star_size) 95 | x = x + dist_of_stars 96 | y = y - dist_bet_lines 97 | 98 | 99 | def stars_five(): 100 | dist_of_stars = 30 101 | dist_bet_lines = stripe_ht + 6 102 | y = 100 103 | # create 4 rows of stars 104 | for row in range(0,4) : 105 | x = -217 106 | # create 5 stars in each row 107 | for star in range (0,5) : 108 | star_shape(x, y, 'white', star_size) 109 | x = x + dist_of_stars 110 | y = y - dist_bet_lines 111 | 112 | #Call all the functions 113 | # start after 5 seconds. 114 | time.sleep(5) 115 | # draw 13 stripes 116 | draw_stripes() 117 | # draw squares 118 | draw_square() 119 | # draw 30 stars, 6 * 5 120 | stars1() 121 | # draw 20 stars, 5 * 4 122 | stars_five() 123 | # hides the turtle 124 | t.hideturtle() 125 | scr.mainloop() -------------------------------------------------------------------------------- /i-love-you.py: -------------------------------------------------------------------------------- 1 | # Importing turtle library to draw "I Love You" 2 | import turtle 3 | 4 | # Creating our turtle cursor to draw 5 | my_turtle_cursor = turtle.Turtle() 6 | 7 | # Creating a separate Canvas to draw "I Love You" 8 | my_turtle_screen = turtle.Screen() 9 | 10 | 11 | # Creating a pause function to pause the cursor 12 | def pause(): 13 | my_turtle_cursor.speed(2) 14 | for i in range(100): 15 | my_turtle_cursor.left(90) 16 | 17 | 18 | # Function to write "I" inside heart 19 | def write_I_inside_heart(): 20 | 21 | my_turtle_cursor.penup() 22 | 23 | # Co-ordinates where we have to write "I" 24 | my_turtle_cursor.goto(-230, 15) 25 | 26 | # Setting the text color of our text 27 | my_turtle_cursor.pencolor("#FFFFFF") 28 | 29 | # Adding the text and changing the font of our text 30 | my_turtle_cursor.write("I", font=("Helevetica", 54, "bold")) 31 | 32 | 33 | 34 | # Function to write "Love" inside heart 35 | def write_Love_inside_heart(): 36 | 37 | my_turtle_cursor.penup() 38 | 39 | # Co-ordinates where we have to write "Love" 40 | my_turtle_cursor.goto(-160, 15) 41 | 42 | # Setting the text color of our text 43 | my_turtle_cursor.pencolor("#FFFFFF") 44 | 45 | # Adding the text and changing the font of our text 46 | my_turtle_cursor.write("Love", font=("Helevetica", 54, "bold")) 47 | 48 | 49 | # Function to write "You" inside heart 50 | def write_you_inside_heart(): 51 | 52 | my_turtle_cursor.penup() 53 | 54 | # Co-ordinates where we have to write "You" 55 | my_turtle_cursor.goto(80, 15) 56 | 57 | # Setting the text color of our text 58 | my_turtle_cursor.pencolor("#FFFFFF") 59 | 60 | # Adding the text and changing the font of our text 61 | my_turtle_cursor.write("You", font=("Helevetica", 54, "bold")) 62 | 63 | 64 | # Method to draw a heart 65 | def draw_complete_heart(): 66 | # Set the fill color to #FF0000 67 | my_turtle_cursor.fillcolor("#FF0000") 68 | 69 | # Start filling the color 70 | my_turtle_cursor.begin_fill() 71 | 72 | # Draw the left line 73 | my_turtle_cursor.left(140) 74 | my_turtle_cursor.forward(294) 75 | 76 | # Calling the function to draw left curve of our heart 77 | draw_left_curve_of_heart() 78 | 79 | # Draw the left line 80 | my_turtle_cursor.right(190) 81 | 82 | # Calling the function to draw right curve of our heart 83 | draw_right_curve_of_heart() 84 | 85 | # Draw the right line 86 | my_turtle_cursor.forward(294) 87 | 88 | # Ending the filling of the color 89 | my_turtle_cursor.end_fill() 90 | 91 | 92 | # Defining a method to draw left curve 93 | def draw_left_curve_of_heart(): 94 | 95 | my_turtle_cursor.speed(50) 96 | # For Loop for creating left curves 97 | for i in range(450): 98 | my_turtle_cursor.right(0.5) 99 | my_turtle_cursor.forward(1.2) 100 | 101 | 102 | # Defining a method to draw right curve 103 | def draw_right_curve_of_heart(): 104 | 105 | my_turtle_cursor.speed(50) 106 | # For Loop for creating right curves 107 | for i in range(450): 108 | my_turtle_cursor.right(0.5) 109 | my_turtle_cursor.forward(1.2) 110 | 111 | 112 | # Changing start position of our turtle cursor 113 | my_turtle_cursor.penup() 114 | my_turtle_cursor.goto(0, -200) 115 | my_turtle_cursor.pendown() 116 | 117 | # Setting the speed of our cursor 118 | my_turtle_cursor.speed(50) 119 | 120 | # Calling a Function to Draw a complete Heart Background 121 | draw_complete_heart() 122 | 123 | # Calling a Function to write "I" Inside our hearth Background 124 | write_I_inside_heart() 125 | 126 | # Calling a Function to write "Love" Inside our hearth Background 127 | write_Love_inside_heart() 128 | 129 | # Calling a Function to write "You" Inside our hearth Background 130 | write_you_inside_heart() 131 | 132 | turtle.done() -------------------------------------------------------------------------------- /planet-simulator.py: -------------------------------------------------------------------------------- 1 | # Imports 2 | import sys 3 | import pygame 4 | 5 | # We will work with the Vector2 because it has some useful functions. 6 | from pygame.math import Vector2 7 | 8 | from random import randrange 9 | 10 | import ctypes 11 | 12 | # Enable High Dots Per Inch so the image displayed on the window is sharper. 13 | ctypes.windll.shcore.SetProcessDpiAwareness(1) 14 | 15 | # Configuration 16 | pygame.init() 17 | fps = 60 18 | fpsClock = pygame.time.Clock() 19 | 20 | # Window Size 21 | windowdim = Vector2(800, 800) 22 | screen = pygame.display.set_mode((int(windowdim.x), int(windowdim.y))) 23 | 24 | # all the Planets are stored here 25 | # They will append themselves. 26 | planets = [] 27 | 28 | # The Planet Class which will handle drawing and calculating planets. 29 | class Planet(): 30 | def __init__(self, position, delta=Vector2(0, 0), radius=10, imovable=False): 31 | 32 | # Where the planet is at the moment 33 | self.position = position 34 | 35 | # The Radius determines how much this planet effects others 36 | self.radius = radius 37 | 38 | # The Velocity 39 | self.delta = delta 40 | 41 | # If this planet is moving 42 | self.imovable = imovable 43 | 44 | # If this planet can be eaten by others. 45 | self.eatable = False 46 | 47 | 48 | # Appending itself to the list so its process 49 | # function will later be called in a loop. 50 | planets.append(self) 51 | 52 | 53 | def process(self): 54 | # This function will be called once every frame 55 | # and it is responsible for calculating where the planet will go. 56 | 57 | # No Movement Calculations will happen if the planet doesnt move at all. 58 | # it also wont be eaten. 59 | if not self.imovable: 60 | for i in planets: 61 | 62 | if not i is self: 63 | try: 64 | if self.eatable: 65 | if self.position.distance_to(i.position) < self.radius + i.radius: 66 | print('Eaten') 67 | 68 | i.radius += self.radius 69 | 70 | planets.remove(self) 71 | 72 | dir_from_obj = (i.position - self.position).normalize() * 0.01 * (i.radius / 10) 73 | self.delta += dir_from_obj 74 | 75 | except: 76 | print('In the same spot') 77 | 78 | self.position += self.delta 79 | 80 | # Drawing the planet at the current position. 81 | pygame.draw.circle( 82 | screen, 83 | [255, 255, 255], 84 | self.position, 85 | self.radius, 86 | ) 87 | 88 | # Sun and two opposing Planets 89 | """ Planet(Vector2(400, 400), radius=50, imovable=True) 90 | 91 | Planet(Vector2(400, 200), delta=Vector2(3, 0), radius=10) 92 | Planet(Vector2(400, 600), delta=Vector2(-3, 0), radius=10) """ 93 | 94 | # Sun and four opposing Planets 95 | """ Planet(Vector2(400, 400), radius=50, imovable=True) 96 | 97 | Planet(Vector2(400, 200), delta=Vector2(3, 0), radius=10) 98 | Planet(Vector2(400, 600), delta=Vector2(-3, 0), radius=10) 99 | Planet(Vector2(600, 400), delta=Vector2(0, 3), radius=10) 100 | Planet(Vector2(200, 400), delta=Vector2(0, -3), radius=10) """ 101 | 102 | # Two Suns and two planets 103 | """ Planet(Vector2(600, 400), radius=20, imovable=True) 104 | Planet(Vector2(200, 400), radius=20, imovable=True) 105 | 106 | Planet(Vector2(400, 200), delta=Vector2(0, 0), radius=10) 107 | Planet(Vector2(400, 210), delta=Vector2(1, 2), radius=5) """ 108 | 109 | # Grid 110 | gridDimension = 10 111 | gridgap = 80 112 | for x in range(gridDimension): 113 | for y in range(gridDimension): 114 | Planet(Vector2(gridgap * x + 40, gridgap * y + 40), radius=3, imovable=True) 115 | 116 | Planet(Vector2(200, 200), delta=Vector2(randrange(-3, 3), 2), radius=5) 117 | 118 | # Game loop. 119 | while True: 120 | screen.fill((0, 0, 0)) 121 | for event in pygame.event.get(): 122 | if event.type == pygame.QUIT: 123 | pygame.quit() 124 | sys.exit() 125 | 126 | for p in planets: 127 | p.process() 128 | 129 | pygame.display.flip() 130 | fpsClock.tick(fps) 131 | -------------------------------------------------------------------------------- /spiderman.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | 3 | speed(13) # Painting speed control 4 | bgcolor("#990000") 5 | pensize(10) 6 | penup() 7 | goto(0,50) 8 | pendown() 9 | circle(-120) 10 | penup() 11 | circle(-120,-60) 12 | pendown() 13 | pensize(5) 14 | right(50) 15 | circle(70,55) 16 | right(85) 17 | circle(75,58) 18 | right(90) 19 | circle(70,55) 20 | right(90) 21 | circle(70,58) 22 | 23 | # body 24 | penup() 25 | pensize(10) 26 | goto(80,15) 27 | pendown() 28 | seth(92) 29 | fd(135) 30 | seth(125) 31 | circle(30,135) 32 | seth(190) 33 | fd(50) 34 | seth(125) 35 | circle(30,135) 36 | seth(275) 37 | fd(90) 38 | 39 | # Arm 1 40 | penup() 41 | pensize(10) 42 | goto(92,-150) 43 | seth(240) 44 | pendown() 45 | fd(80) 46 | left(10) 47 | circle(-28,185) 48 | 49 | # Arm 2 50 | penup() 51 | goto(0,50) 52 | seth(0) 53 | pensize(10) 54 | circle(-120,-60) 55 | seth(200) 56 | pendown() 57 | fd(72) 58 | left(20) 59 | circle(30,150) 60 | left(20) 61 | fd(20) 62 | right(15) 63 | fd(10) 64 | pensize(5) 65 | fillcolor("#3366cc") 66 | begin_fill() 67 | seth(92) 68 | circle(-120,31) 69 | seth(200) 70 | fd(45) 71 | left(90) 72 | fd(52) 73 | end_fill() 74 | fd(-12) 75 | right(90) 76 | fd(40) 77 | penup() 78 | right(90) 79 | fd(18) 80 | pendown() 81 | right(86) 82 | fd(40) 83 | penup() 84 | goto(-152,-86) 85 | pendown() 86 | left(40) 87 | circle(35,90) 88 | # Body coloring 89 | penup() 90 | goto(-80,116) 91 | seth(10) 92 | pensize(5) 93 | pendown() 94 | begin_fill() 95 | fillcolor("#3366cc") 96 | fd(155) 97 | seth(-88) 98 | fd(37) 99 | seth(195) 100 | fd(156) 101 | end_fill() 102 | penup() 103 | goto(-75,38) 104 | seth(15) 105 | pendown() 106 | begin_fill() 107 | fd(158) 108 | seth(-88) 109 | fd(55) 110 | seth(140) 111 | circle(120,78) 112 | end_fill() 113 | # Arm 1 To color 114 | penup() 115 | fillcolor("#3366cc") 116 | pensize(5) 117 | goto(75,-170) 118 | pendown() 119 | begin_fill() 120 | seth(240) 121 | fd(30) 122 | right(90) 123 | fd(17) 124 | end_fill() 125 | fd(10) 126 | left(80) 127 | fd(55) 128 | penup() 129 | left(90) 130 | fd(15) 131 | pendown() 132 | left(85) 133 | fd(55) 134 | penup() 135 | goto(43,-225) 136 | left(84) 137 | pendown() 138 | circle(60,51) 139 | speed(0) 140 | 141 | # Body vertical lines 142 | for i in range(3): 143 | penup() 144 | goto(-70+i*15,135) 145 | seth(-90) 146 | pendown() 147 | pensize(5) 148 | fd(15-2*i) 149 | 150 | for i in range(3): 151 | penup() 152 | goto(36 + i * 15, 156) 153 | seth(-90) 154 | pendown() 155 | pensize(5) 156 | fd(15 - 2 * i) 157 | a = -60 158 | b = 70 159 | 160 | for i in range(4): 161 | penup() 162 | goto(a,b) 163 | a=a+40 164 | b=b+10 165 | seth(-90) 166 | pendown() 167 | pensize(5) 168 | fd(26) 169 | 170 | def oo (li,jing): 171 | penup() 172 | goto(0,50) 173 | seth(0) 174 | circle(-120, li) 175 | pendown() 176 | right(jing) 177 | pensize(5) 178 | oo(-60,110) 179 | fd(130) 180 | oo(-28,96) 181 | fd(140) 182 | oo(9,89) 183 | fd(144) 184 | oo(42,70) 185 | fd(160) 186 | oo(80,60) 187 | fd(130) 188 | penup() 189 | goto(-80,-40) 190 | right(160) 191 | pendown() 192 | right(50) 193 | circle(70,45) 194 | right(75) 195 | circle(70,38) 196 | right(50) 197 | circle(70,45) 198 | right(90) 199 | circle(70,48) 200 | penup() 201 | goto(-53,-70) 202 | pendown() 203 | left(40) 204 | circle(70,30) 205 | right(50) 206 | circle(70,20) 207 | right(50) 208 | circle(70,38) 209 | right(70) 210 | circle(70,24) 211 | penup() 212 | goto(-19,-105) 213 | left(72) 214 | pendown() 215 | fd(22) 216 | right(60) 217 | fd(22) 218 | oo(-140,80) 219 | circle(-90,120) 220 | penup() 221 | oo(140,100) 222 | circle(90,13) 223 | pendown() 224 | 225 | 226 | right(-50) 227 | circle(70,45) 228 | right(75) 229 | circle(70,38) 230 | right(50) 231 | circle(70,36) 232 | penup() 233 | goto(22,-185) 234 | right(70) 235 | pendown() 236 | fd(72) 237 | penup() 238 | goto(-40,-182) 239 | right(38) 240 | pendown() 241 | fd(70) 242 | speed(10) 243 | # The left eye 244 | penup() 245 | pensize(7) 246 | goto(-15,-110) 247 | seth(0) 248 | pendown() 249 | pensize(10) 250 | begin_fill() 251 | left(130) 252 | fd(110) 253 | right(250) 254 | circle(90,60) 255 | circle(40,120) 256 | fillcolor("#F5FFFA") 257 | end_fill() 258 | 259 | # Right eye 260 | penup() 261 | goto(5,-110) 262 | pendown() 263 | begin_fill() 264 | right(30) 265 | fd(110) 266 | right(-250) 267 | circle(-90,60) 268 | circle(-40,120) 269 | end_fill() 270 | done() -------------------------------------------------------------------------------- /superman-logo.py: -------------------------------------------------------------------------------- 1 | import turtle #import the required package to draw the logo 2 | 3 | t=turtle.Turtle() #set the variable ‘t’ to the function turtle.Turtle() to shorten the code throughout 4 | turtle.Screen().bgcolor('navy') #set the color of the screen to navy to match Superman’s costume 5 | 6 | def curve(value): #create a function to generate curves in turtle 7 | for i in range(value): #for loop to repeat the inputted value number of times 8 | t.right(1) #step by step curve 9 | t.forward(1) 10 | 11 | t.penup() #pen is in the up position so it will not draw 12 | t.setposition(0,43) #move the pen to these x and y coordinates 13 | t.pendown() #pen is in the down position so it will draw 14 | t.begin_fill() #start filling in the shape 15 | t.pencolor('black') #change the pen color to black 16 | t.fillcolor('maroon') #change the shape fill color to maroon to match the Superman logo 17 | t.pensize(3) #use a pen size of 3 to create a black border 18 | t.forward(81.5) #the pen will move forward this number to start the shield of the logo 19 | t.right(49.4) #rotate the pen right 49.4 degrees 20 | t.forward(58) #move the pen forward by 58 21 | t.right(81.42) #rotate right by 81.42 degrees 22 | t.forward(182) #move the pen forward by 182 23 | t.right(98.36) #rotate the pen right by 98.36 degrees 24 | t.forward(182) #move the pen forward by 182 25 | t.right(81.42) #rotate the pen by 81.42 degrees to the right 26 | t.forward(58) #move the pen forward 58 27 | t.right(49.4) #rotate the pen to the right by 49.4 28 | t.forward(81.5) #move the pen forward by 81.5 to meet the start at the top of the shield 29 | t.end_fill() #complete the fill of the shield so the shape is closed off 30 | t.penup() #pen will not draw 31 | 32 | t.setposition(38,32) #now to create the yellow parts of the Superman logo 33 | t.pendown() #the pen is now poised to draw 34 | t.begin_fill() #start a new shape 35 | t.fillcolor('gold') #change the fill color to gold to match the Superman logo 36 | t.forward(13) #move the pen forward by 13 37 | t.right(120) #rotate the pen right by 120 degrees 38 | t.forward(13) #move the pen forward by 13 39 | t.right(120) #rotate the pen right by 120 degrees 40 | t.forward(13) #move the pen forward by 13 41 | t.end_fill() #the small triangle on the right is now complete 42 | t.penup() #stop the pen from drawing 43 | 44 | t.setposition(81.5,25) #now to create the larger yellow part of the Superman logo, change the position of the pen 45 | t.pendown() #the pen will now draw again 46 | t.begin_fill() #the fill is still the same color set before 47 | t.right(210) #rotate the pen right by 210 degrees 48 | t.forward(25) #move the pen forward by 25 49 | t.right(90) #rotate the pen right by 90 degrees 50 | t.forward(38) #move the pen forward by 38 51 | t.right(45) #rotate the pen right by 45 degrees 52 | t.circle(82,90) #this function is used to draw a circle in turtle, the first integer is the radius and the second is the number of degrees of the circle drawn 53 | t.left(90) #rotate the pen left by 90 degrees 54 | t.circle(82,60) #create a circle of radius 82 and only complete 60 degrees of the circle 55 | curve(61) #call the curve function that was previously defined, pass an integer value equal to the length of the curve desired 56 | t.left(90) #rotate the pen left by 90 degrees 57 | t.forward(57) #move the pen forward by 57 58 | t.left(90) #rotate the pen left by 90 degrees 59 | t.forward(32) #move the pen forward by 32 60 | t.end_fill() #fill in the larger yellow part of the logo 61 | t.penup() #stop drawing 62 | t.home() #reset the pen location to the origin so the orientation is also reset 63 | 64 | t.setposition(-69,-38) #finish the major parts of the S superimposition on the shield 65 | t.pendown() 66 | t.begin_fill() 67 | curve(20) 68 | t.forward(33) 69 | t.left(10) 70 | t.circle(82,20) 71 | curve(30) 72 | t.forward(10) 73 | t.right(110) 74 | curve(40) 75 | t.right(10) 76 | t.circle(50,10) 77 | curve(45) 78 | t.right(5) 79 | t.forward(45) 80 | t.end_fill() 81 | t.penup() 82 | t.home() 83 | 84 | t.setposition(20,-100) 85 | t.pendown() 86 | t.begin_fill() 87 | t.right(135) 88 | t.forward(27) 89 | t.right(90) 90 | t.forward(27) 91 | t.right(135) 92 | t.forward(38.18) 93 | t.end_fill() 94 | t.penup() 95 | t.home() 96 | 97 | t.setposition(-57,32) 98 | t.pendown() 99 | t.begin_fill() 100 | t.right(180) 101 | t.forward(18) 102 | t.left(45) 103 | t.forward(44) 104 | t.left(80) 105 | t.forward(15) 106 | t.left(130) 107 | curve(40) 108 | t.forward(20) 109 | t.end_fill() 110 | 111 | t.hideturtle() #use this command to hide the turtle so it is not visible in the final image 112 | turtle.exitonclick() #this command will leave the window -------------------------------------------------------------------------------- /happy-diwali-1.py: -------------------------------------------------------------------------------- 1 | from tkinter.font import ITALIC 2 | from tkinter.ttk import Style 3 | import turtle 4 | import colorsys 5 | import random 6 | 7 | #Create a turtle screen 8 | screen=turtle.Screen() 9 | 10 | #Define height and width of screen 11 | screen.setup(1200,600) 12 | 13 | #Define Background color of screen 14 | screen.bgcolor('black') 15 | 16 | #Initialize a variable for turtle 17 | t=turtle.Turtle() 18 | 19 | # Define title of program 20 | turtle.title("Copy Assignment Turtle") 21 | 22 | #Defining speed of turtle 23 | t.speed(10) 24 | 25 | #To hide the turtle pointer 26 | t.hideturtle() 27 | hue=0.0 28 | 29 | 30 | 31 | size=random.randint(10,200) 32 | 33 | # for i in range(36): 34 | # color=colorsys.hsv_to_rgb(hue,1,1) 35 | # t.pencolor("orange") 36 | # t.left(10) 37 | # hue +=0.1 38 | 39 | # Code for writing Happy Diwali on Canvas 40 | def write(message,pos): 41 | x,y=pos 42 | # Define color of the text 43 | t.pencolor("orange") 44 | t.penup() 45 | t.goto(x,y) 46 | # Defining font style and size 47 | style=('Arial',100) 48 | t.write(message,font=style) 49 | 50 | write('Happy Diwali',(-380,-50)) 51 | 52 | # Code for drawing firecrackers 53 | #Defining function for drawing firecrackers 54 | def draw_firecrackers(x,y): 55 | t.penup() 56 | t.goto(x,y) 57 | t.pendown() 58 | 59 | #color of the firecracker 60 | t.color("red") 61 | 62 | #Initializing the pointer 63 | angle=0 64 | for i in range(20): 65 | #move in forward direction 66 | t.fd(50) 67 | 68 | #calling the function and initializing the values 69 | draw_firecrackers(300,180) 70 | 71 | #changing the angle of pointer 72 | angle+=18 73 | 74 | t.left(angle) 75 | draw_firecrackers(450,180) 76 | 77 | #color of the firecracker 78 | t.color("blue") 79 | angle=0 80 | for i in range(20): 81 | t.fd(50) 82 | angle+=18 83 | t.left(angle) 84 | draw_firecrackers(450,180) 85 | draw_firecrackers(375,300) 86 | 87 | #color of the firecracker 88 | t.color("green") 89 | angle=0 90 | for i in range(20): 91 | t.fd(50) 92 | angle+=18 93 | t.left(angle) 94 | draw_firecrackers(375,300) 95 | draw_firecrackers(375,-300) 96 | 97 | #color of the firecracker 98 | t.color("orange") 99 | angle=0 100 | for i in range(20): 101 | t.fd(50) 102 | angle+=18 103 | t.left(angle) 104 | draw_firecrackers(375,-300) 105 | draw_firecrackers(150,-150) 106 | 107 | #color of the firecracker 108 | t.color("violet") 109 | angle=0 110 | for i in range(20): 111 | t.fd(50) 112 | angle+=18 113 | t.left(angle) 114 | draw_firecrackers(150,-150) 115 | draw_firecrackers(450,-150) 116 | 117 | #color of the firecracker 118 | t.color("brown") 119 | angle=0 120 | for i in range(20): 121 | t.fd(50) 122 | angle+=18 123 | t.left(angle) 124 | draw_firecrackers(450,-150) 125 | draw_firecrackers(-200,-300) 126 | 127 | #color of the firecracker 128 | t.color("green") 129 | angle=0 130 | for i in range(20): 131 | t.fd(50) 132 | angle+=18 133 | t.left(angle) 134 | draw_firecrackers(-200,-300) 135 | draw_firecrackers(125,0) 136 | 137 | #color of the firecracker 138 | t.color("pink") 139 | angle=0 140 | draw_firecrackers(-100,-200) 141 | for i in range(20): 142 | t.fd(50) 143 | angle+=18 144 | t.left(angle) 145 | draw_firecrackers(-100,-200) 146 | 147 | #color of the firecracker 148 | t.color("skyblue") 149 | angle=0 150 | draw_firecrackers(-500,-240) 151 | for i in range(20): 152 | t.fd(50) 153 | angle+=18 154 | t.left(angle) 155 | draw_firecrackers(-500,-240) 156 | 157 | #color of the firecracker 158 | t.color("orange") 159 | angle=0 160 | draw_firecrackers(-350,-170) 161 | for i in range(20): 162 | t.fd(50) 163 | angle+=18 164 | t.left(angle) 165 | draw_firecrackers(-350,-170) 166 | 167 | #color of the firecracker 168 | t.color("pink") 169 | angle=0 170 | for i in range(20): 171 | t.fd(50) 172 | draw_firecrackers(-550,300) 173 | angle+=18 174 | t.left(angle) 175 | draw_firecrackers(-450,180) 176 | 177 | #color of the firecracker 178 | t.color("green") 179 | angle=0 180 | for i in range(20): 181 | t.fd(50) 182 | angle+=18 183 | t.left(angle) 184 | draw_firecrackers(-450,180) 185 | draw_firecrackers(-375,300) 186 | t.color("yellow") 187 | angle=0 188 | for i in range(20): 189 | t.fd(50) 190 | t.left(angle) 191 | angle+=18 192 | draw_firecrackers(-375,300) 193 | draw_firecrackers(-375,-300) 194 | 195 | # To hold the screen to display 196 | screen.mainloop() -------------------------------------------------------------------------------- /saraswati.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | turtle.bgcolor("gold") 3 | turtle.title("Durga") 4 | def pos(x,y): 5 | turtle.penup() 6 | turtle.goto(x,y) 7 | turtle.pendown() 8 | #For Bindi 9 | pos(0,200) 10 | turtle.color("red") 11 | turtle.begin_fill() 12 | turtle.circle(40) 13 | turtle.end_fill() 14 | 15 | #for Left Eyebrow 16 | pos(-30,200) 17 | turtle.color("black") 18 | turtle.begin_fill() 19 | turtle.right(45) 20 | for i in range(20): 21 | turtle.left(3) 22 | turtle.back(10) 23 | for i in range(10): 24 | turtle.right(3) 25 | turtle.back(10) 26 | turtle.right(18) 27 | for i in range(13): 28 | turtle.left(3) 29 | turtle.forward(10) 30 | for i in range(20): 31 | turtle.right(2) 32 | turtle.forward(10) 33 | turtle.end_fill() 34 | 35 | 36 | #For Right Eyebrow 37 | turtle.left(80) 38 | pos(30,200) 39 | turtle.color("black") 40 | turtle.begin_fill() 41 | for i in range(20): 42 | turtle.right(3) 43 | turtle.forward(10) 44 | for i in range(10): 45 | turtle.left(3) 46 | turtle.forward(10) 47 | turtle.left(18) 48 | for i in range(13): 49 | turtle.right(3) 50 | turtle. back(10) 51 | for i in range(20): 52 | turtle. left(2) 53 | turtle. back(10) 54 | turtle.end_fill() 55 | 56 | #For Left Eye 57 | pos(40,150) 58 | turtle.pensize(15) 59 | turtle.left(10) 60 | for i in range(20): 61 | turtle.right(3) 62 | turtle. forward(10) 63 | for i in range(10): 64 | turtle.left(3) 65 | turtle.forward(5) 66 | turtle.right(3) 67 | for i in range(10): 68 | turtle.left(3) 69 | turtle.back(5) 70 | for i in range(20): 71 | turtle.right(3) 72 | turtle.back(10) 73 | turtle.pensize(1) 74 | pos(130,130) 75 | turtle.begin_fill() 76 | turtle.circle(40) 77 | turtle.end_fill() 78 | turtle.color("white") 79 | turtle.begin_fill() 80 | pos(115,175) 81 | turtle. circle(10) 82 | turtle. end_fill() 83 | 84 | 85 | #For Right Eye 86 | pos(-40,150) 87 | turtle.color("black") 88 | turtle.pensize(15) 89 | turtle.right(25) 90 | for i in range(20): 91 | turtle.left(3) 92 | turtle.back(10) 93 | for i in range(10): 94 | turtle.right(3) 95 | turtle.back(5) 96 | turtle.left(3) 97 | for i in range(10): 98 | turtle.right(3) 99 | turtle.forward(5) 100 | for i in range(20): 101 | turtle.left(3) 102 | turtle.forward(10) 103 | turtle.pensize(1) 104 | pos(-130,130) 105 | turtle.begin_fill() 106 | turtle.circle(40) 107 | turtle.end_fill() 108 | turtle.color("white") 109 | turtle.begin_fill() 110 | pos(-155,175) 111 | turtle.circle(10) 112 | turtle.end_fill() 113 | 114 | #For Nose 115 | turtle.color("black") 116 | pos(-60,10) 117 | turtle.right(70) 118 | for i in range(5,12): 119 | turtle.pensize(i) 120 | turtle.left(7) 121 | turtle.forward(10) 122 | for i in range(12,5,-1): 123 | turtle.pensize(i) 124 | turtle.left(7) 125 | turtle.forward(10) 126 | 127 | #for Upper lip 128 | turtle.begin_fill() 129 | pos(-130,-90) 130 | turtle.color("red") 131 | turtle.pensize(1) 132 | turtle.begin_fill() 133 | turtle.right(60) 134 | for i in range(3): 135 | turtle.left(3) 136 | turtle.forward(5) 137 | for i in range(10): 138 | turtle.left(4) 139 | turtle.forward(6) 140 | for i in range(10): 141 | turtle.right(10) 142 | turtle.forward(7) 143 | turtle.left(135) 144 | for i in range(10): 145 | turtle.right(10) 146 | turtle.forward(7) 147 | turtle.right(2) 148 | for i in range(10): 149 | turtle.left(4) 150 | turtle.forward(6) 151 | for i in range(3): 152 | turtle.left(3) 153 | turtle.forward(5) 154 | turtle.right(160) 155 | for i in range(12): 156 | turtle.right(3) 157 | turtle.forward(7.2) 158 | turtle.left(44) 159 | for i in range(15): 160 | turtle.right(5.5) 161 | turtle. forward(7) 162 | turtle.left(44) 163 | for i in range(12): 164 | turtle.right(3) 165 | turtle.forward(7) 166 | turtle.end_fill() 167 | 168 | #For lower Lip 169 | turtle.begin_fill() 170 | turtle.left(175) 171 | for i in range(14): 172 | turtle.left(2) 173 | turtle.forward(5) 174 | turtle.right(45) 175 | for i in range(14): 176 | turtle.left(7) 177 | turtle.forward(10) 178 | turtle.right(45) 179 | for i in range(14): 180 | turtle.left(3) 181 | turtle.forward(5) 182 | turtle.right(185) 183 | for i in range(7): 184 | turtle.left(3) 185 | turtle.forward(10) 186 | turtle.right(.6) 187 | for i in range(18): 188 | turtle.right(6) 189 | turtle.forward(10) 190 | turtle.right(8) 191 | for i in range(7): 192 | turtle.left(3) 193 | turtle.forward(10) 194 | turtle.end_fill() 195 | #For Nosering 196 | turtle.pensize(12) 197 | turtle.color("yellow") 198 | pos(30,0) 199 | turtle.left(120) 200 | for i in range(47): 201 | turtle.right(7) 202 | turtle.back(10) 203 | turtle.hideturtle() 204 | turtle.exitonclick() 205 | -------------------------------------------------------------------------------- /solar-system.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import math 3 | 4 | class SolarSystem: 5 | def __init__(self, width, height): 6 | self.thesun = None 7 | self.planets = [] 8 | self.ssturtle = turtle.Turtle() 9 | self.ssturtle.hideturtle() 10 | self.ssscreen = turtle.Screen() 11 | self.ssscreen.setworldcoordinates(-width/2.0,-height/2.0,width/2.0,height/2.0) 12 | self.ssscreen.tracer(50) 13 | 14 | def addPlanet(self, aplanet): 15 | self.planets.append(aplanet) 16 | 17 | turtle.title("Solar System") 18 | turtle.Screen().bgcolor("black") 19 | def addSun(self, asun): 20 | self.thesun = asun 21 | 22 | def showPlanets(self): 23 | for aplanet in self.planets: 24 | print(aplanet) 25 | 26 | def freeze(self): 27 | self.ssscreen.exitonclick() 28 | 29 | def movePlanets(self): 30 | G = .1 31 | dt = .001 32 | 33 | for p in self.planets: 34 | p.moveTo(p.getXPos() + dt * p.getXVel(), p.getYPos() + dt * p.getYVel()) 35 | 36 | rx = self.thesun.getXPos() - p.getXPos() 37 | ry = self.thesun.getYPos() - p.getYPos() 38 | r = math.sqrt(rx**2 + ry**2) 39 | 40 | accx = G * self.thesun.getMass()*rx/r**3 41 | accy = G * self.thesun.getMass()*ry/r**3 42 | 43 | p.setXVel(p.getXVel() + dt * accx) 44 | 45 | p.setYVel(p.getYVel() + dt * accy) 46 | 47 | class Sun: 48 | def __init__(self, iname, irad, im, itemp): 49 | self.name = iname 50 | self.radius = irad 51 | self.mass = im 52 | self.temp = itemp 53 | self.x = 0 54 | self.y = 0 55 | 56 | self.sturtle = turtle.Turtle() 57 | self.sturtle.shape("circle") 58 | self.sturtle.color("yellow") 59 | 60 | def getName(self): 61 | return self.name 62 | 63 | def getRadius(self): 64 | return self.radius 65 | 66 | def getMass(self): 67 | return self.mass 68 | 69 | def getTemperature(self): 70 | return self.temp 71 | 72 | def getVolume(self): 73 | v = 4.0/3 * math.pi * self.radius**3 74 | return v 75 | 76 | def getSurfaceArea(self): 77 | sa = 4.0 * math.pi * self.radius**2 78 | return sa 79 | 80 | def getDensity(self): 81 | d = self.mass / self.getVolume() 82 | return d 83 | 84 | def setName(self, newname): 85 | self.name = newname 86 | 87 | def __str__(self): 88 | return self.name 89 | 90 | def getXPos(self): 91 | return self.x 92 | 93 | def getYPos(self): 94 | return self.y 95 | 96 | class Planet: 97 | 98 | def __init__(self, iname, irad, im, idist, ivx, ivy, ic): 99 | self.name = iname 100 | self.radius = irad 101 | self.mass = im 102 | self.distance = idist 103 | self.x = idist 104 | self.y = 0 105 | self.velx = ivx 106 | self.vely = ivy 107 | self.color = ic 108 | 109 | self.pturtle = turtle.Turtle() 110 | self.pturtle.up() 111 | self.pturtle.color(self.color) 112 | self.pturtle.shape("circle") 113 | self.pturtle.goto(self.x,self.y) 114 | self.pturtle.down() 115 | 116 | def getName(self): 117 | return self.name 118 | 119 | def getRadius(self): 120 | return self.radius 121 | 122 | def getMass(self): 123 | return self.mass 124 | 125 | def getDistance(self): 126 | return self.distance 127 | 128 | def getVolume(self): 129 | v = 4.0/3 * math.pi * self.radius**3 130 | return v 131 | 132 | def getSurfaceArea(self): 133 | sa = 4.0 * math.pi * self.radius**2 134 | return sa 135 | 136 | def getDensity(self): 137 | d = self.mass / self.getVolume() 138 | return d 139 | 140 | def setName(self, newname): 141 | self.name = newname 142 | 143 | def show(self): 144 | print(self.name) 145 | 146 | def __str__(self): 147 | return self.name 148 | 149 | def moveTo(self, newx, newy): 150 | self.x = newx 151 | self.y = newy 152 | self.pturtle.goto(newx, newy) 153 | 154 | def getXPos(self): 155 | return self.x 156 | 157 | def getYPos(self): 158 | return self.y 159 | 160 | def getXVel(self): 161 | return self.velx 162 | 163 | def getYVel(self): 164 | return self.vely 165 | 166 | def setXVel(self, newvx): 167 | self.velx = newvx 168 | 169 | def setYVel(self, newvy): 170 | self.vely = newvy 171 | 172 | 173 | def createSSandAnimate(): 174 | ss = SolarSystem(2,2) 175 | 176 | sun = Sun("SUN", 5000, 10, 5800) 177 | ss.addSun(sun) 178 | 179 | 180 | m = Planet("MERCURY", 19.5, 1000, .25, 0, 2, "blue") 181 | ss.addPlanet(m) 182 | 183 | m = Planet("EARTH", 47.5, 5000, 0.3, 0, 2.0, "green") 184 | ss.addPlanet(m) 185 | 186 | m = Planet("MARS", 50, 9000, 0.5, 0, 1.63, "red") 187 | ss.addPlanet(m) 188 | 189 | m = Planet("JUPITER", 100, 49000, 0.7, 0, 1, "pink") 190 | ss.addPlanet(m) 191 | 192 | m = Planet("Pluto", 1, 500, 0.9, 0, .5, "orange") 193 | ss.addPlanet(m) 194 | 195 | m = Planet("Asteroid", 1, 500, 1.0, 0, .75, "cyan") 196 | ss.addPlanet(m) 197 | 198 | numTimePeriods = 20000 199 | for amove in range(numTimePeriods): 200 | ss.movePlanets() 201 | 202 | ss.freeze() 203 | 204 | createSSandAnimate() -------------------------------------------------------------------------------- /doraemon.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | 3 | 4 | # Doraemon with Python Turtle 5 | def hulk(x, y): 6 | penup() 7 | goto(x, y) 8 | pendown() 9 | 10 | 11 | def avenger(): 12 | fillcolor("#ffffff") 13 | begin_fill() 14 | 15 | tracer(False) 16 | a = 2.5 17 | for i in range(120): 18 | if 0 <= i < 30 or 60 <= i < 90: 19 | a -= 0.05 20 | lt(3) 21 | fd(a) 22 | else: 23 | a += 0.05 24 | lt(3) 25 | fd(a) 26 | tracer(True) 27 | end_fill() 28 | 29 | 30 | def daari(): 31 | hulk(-32, 135) 32 | seth(165) 33 | fd(60) 34 | 35 | hulk(-32, 125) 36 | seth(180) 37 | fd(60) 38 | 39 | hulk(-32, 115) 40 | seth(193) 41 | fd(60) 42 | 43 | hulk(37, 135) 44 | seth(15) 45 | fd(60) 46 | 47 | hulk(37, 125) 48 | seth(0) 49 | fd(60) 50 | 51 | hulk(37, 115) 52 | seth(-13) 53 | fd(60) 54 | 55 | 56 | def mukh(): 57 | hulk(5, 148) 58 | seth(270) 59 | fd(100) 60 | seth(0) 61 | circle(120, 50) 62 | seth(230) 63 | circle(-120, 100) 64 | 65 | 66 | def muflar(): 67 | fillcolor('#e70010') 68 | begin_fill() 69 | seth(0) 70 | fd(200) 71 | circle(-5, 90) 72 | fd(10) 73 | circle(-5, 90) 74 | fd(207) 75 | circle(-5, 90) 76 | fd(10) 77 | circle(-5, 90) 78 | end_fill() 79 | 80 | 81 | def nak(): 82 | hulk(-10, 158) 83 | seth(315) 84 | fillcolor('#e70010') 85 | begin_fill() 86 | circle(20) 87 | end_fill() 88 | 89 | 90 | def black_avenger(): 91 | seth(0) 92 | hulk(-20, 195) 93 | fillcolor('#000000') 94 | begin_fill() 95 | circle(13) 96 | end_fill() 97 | 98 | pensize(6) 99 | hulk(20, 205) 100 | seth(75) 101 | circle(-10, 150) 102 | pensize(3) 103 | 104 | hulk(-17, 200) 105 | seth(0) 106 | fillcolor('#ffffff') 107 | begin_fill() 108 | circle(5) 109 | end_fill() 110 | hulk(0, 0) 111 | 112 | 113 | def face(): 114 | fd(183) 115 | lt(45) 116 | fillcolor('#ffffff') 117 | begin_fill() 118 | circle(120, 100) 119 | seth(180) 120 | # print(pos()) 121 | fd(121) 122 | pendown() 123 | seth(215) 124 | circle(120, 100) 125 | end_fill() 126 | hulk(63.56, 218.24) 127 | seth(90) 128 | avenger() 129 | seth(180) 130 | penup() 131 | fd(60) 132 | pendown() 133 | seth(90) 134 | avenger() 135 | penup() 136 | seth(180) 137 | fd(64) 138 | 139 | 140 | def sumalya(): 141 | penup() 142 | circle(150, 40) 143 | pendown() 144 | fillcolor('#00a0de') 145 | begin_fill() 146 | circle(150, 280) 147 | end_fill() 148 | 149 | 150 | def Doraemon(): 151 | sumalya() 152 | 153 | muflar() 154 | 155 | face() 156 | 157 | nak() 158 | 159 | mukh() 160 | 161 | daari() 162 | 163 | hulk(0, 0) 164 | 165 | seth(0) 166 | penup() 167 | circle(150, 50) 168 | pendown() 169 | seth(30) 170 | fd(40) 171 | seth(70) 172 | circle(-30, 270) 173 | 174 | fillcolor('#00a0de') 175 | begin_fill() 176 | 177 | seth(230) 178 | fd(80) 179 | seth(90) 180 | circle(1000, 1) 181 | seth(-89) 182 | circle(-1000, 10) 183 | 184 | # print(pos()) 185 | 186 | seth(180) 187 | fd(70) 188 | seth(90) 189 | circle(30, 180) 190 | seth(180) 191 | fd(70) 192 | 193 | # print(pos()) 194 | seth(100) 195 | circle(-1000, 9) 196 | 197 | seth(-86) 198 | circle(1000, 2) 199 | seth(230) 200 | fd(40) 201 | 202 | # print(pos()) 203 | 204 | circle(-30, 230) 205 | seth(45) 206 | fd(81) 207 | seth(0) 208 | fd(203) 209 | circle(5, 90) 210 | fd(10) 211 | circle(5, 90) 212 | fd(7) 213 | seth(40) 214 | circle(150, 10) 215 | seth(30) 216 | fd(40) 217 | end_fill() 218 | 219 | seth(70) 220 | fillcolor('#ffffff') 221 | begin_fill() 222 | circle(-30) 223 | end_fill() 224 | 225 | hulk(103.74, -182.59) 226 | seth(0) 227 | fillcolor('#ffffff') 228 | begin_fill() 229 | fd(15) 230 | circle(-15, 180) 231 | fd(90) 232 | circle(-15, 180) 233 | fd(10) 234 | end_fill() 235 | 236 | hulk(-96.26, -182.59) 237 | seth(180) 238 | fillcolor('#ffffff') 239 | begin_fill() 240 | fd(15) 241 | circle(15, 180) 242 | fd(90) 243 | circle(15, 180) 244 | fd(10) 245 | end_fill() 246 | 247 | hulk(-133.97, -91.81) 248 | seth(50) 249 | fillcolor('#ffffff') 250 | begin_fill() 251 | circle(30) 252 | end_fill() 253 | # Doraemon with Python Turtle 254 | 255 | hulk(-103.42, 15.09) 256 | seth(0) 257 | fd(38) 258 | seth(230) 259 | begin_fill() 260 | circle(90, 260) 261 | end_fill() 262 | 263 | hulk(5, -40) 264 | seth(0) 265 | fd(70) 266 | seth(-90) 267 | circle(-70, 180) 268 | seth(0) 269 | fd(70) 270 | 271 | hulk(-103.42, 15.09) 272 | fd(90) 273 | seth(70) 274 | fillcolor('#ffd200') 275 | # print(pos()) 276 | begin_fill() 277 | circle(-20) 278 | end_fill() 279 | seth(170) 280 | fillcolor('#ffd200') 281 | begin_fill() 282 | circle(-2, 180) 283 | seth(10) 284 | circle(-100, 22) 285 | circle(-2, 180) 286 | seth(180 - 10) 287 | circle(100, 22) 288 | end_fill() 289 | goto(-13.42, 15.09) 290 | seth(250) 291 | circle(20, 110) 292 | seth(90) 293 | fd(15) 294 | dot(10) 295 | hulk(0, -150) 296 | 297 | black_avenger() 298 | 299 | 300 | if __name__ == '__main__': 301 | screensize(800, 600, "#f0f0f0") 302 | pensize(3) 303 | speed(9) 304 | Doraemon() 305 | hulk(100, -300) 306 | mainloop() -------------------------------------------------------------------------------- /goku.py: -------------------------------------------------------------------------------- 1 | #Draw Goku Using Python Turtle 2 | 3 | #importing turtle module 4 | import turtle 5 | 6 | #setting the background color 7 | turtle.bgcolor('#f0833a') 8 | 9 | # Define title of program 10 | turtle.title("Copy Assignment Turtle") 11 | 12 | #Create a turtle screen 13 | screen= turtle.Screen() 14 | #Define height and width of screen 15 | screen.setup(1200,600) 16 | 17 | 18 | goku_hair = turtle.Turtle() 19 | goku_hair.speed(20) 20 | goku_hair.penup() 21 | goku_hair.goto(-270,10) 22 | start=goku_hair.pos() 23 | goku_hair.pendown() 24 | goku_hair.begin_fill() 25 | goku_hair.right(-180) 26 | goku_hair.circle(200,extent=45) 27 | goku_hair.rt(160) 28 | goku_hair.circle(-200,extent=45) 29 | goku_hair.lt(115) 30 | goku_hair.circle(200,extent=45) 31 | goku_hair.rt(160) 32 | goku_hair.circle(-200,extent=60) 33 | goku_hair.rt(205) 34 | goku_hair.circle(200,extent=85) 35 | goku_hair.rt(155) 36 | goku_hair.circle(-200,extent=110) 37 | goku_hair.lt(90) 38 | goku_hair.circle(-50,extent=70) 39 | goku_hair.lt(130) 40 | goku_hair.circle(-200,extent=75) 41 | goku_hair.rt(150) 42 | goku_hair.circle(200,extent=65) 43 | goku_hair.lt(125) 44 | goku_hair.circle(-200,extent=45) 45 | goku_hair.rt(160) 46 | goku_hair.circle(200,extent=45) 47 | goku_hair.lt(80) 48 | goku_hair.circle(-200,extent=35) 49 | goku_hair.rt(160) 50 | goku_hair.circle(200,extent=48) 51 | goku_hair.penup() 52 | goku_hair.goto(-270,10) 53 | goku_hair.pendown() 54 | goku_hair.rt(120) 55 | goku_hair.circle(-200,extent=30) 56 | goku_hair.rt(135) 57 | goku_hair.circle(200,extent=20) 58 | goku_hair.lt(145) 59 | goku_hair.circle(-200,extent=30) 60 | goku_hair.rt(150) 61 | goku_hair.circle(200,extent=25) 62 | goku_hair.lt(165) 63 | goku_hair.circle(-200,extent=30) 64 | goku_hair.rt(120) 65 | goku_hair.circle(-200,extent=15) 66 | goku_hair.lt(120) 67 | goku_hair.circle(200,extent=20) 68 | goku_hair.rt(160) 69 | goku_hair.circle(200,extent=24) 70 | 71 | goku_hair.hideturtle() 72 | 73 | #Code for drawing right eye of Goku 74 | goku_reye = turtle.Turtle() 75 | goku_reye.speed(20) 76 | goku_reye.penup() 77 | goku_reye.goto(-180,-20) 78 | goku_reye.pendown() 79 | goku_reye.right(125) 80 | goku_reye.forward(5) 81 | e = goku_reye.pos() 82 | goku_reye.rt(90) 83 | goku_reye.begin_fill() 84 | goku_reye.fd(60) 85 | goku_reye.lt(70) 86 | goku_reye.fd(10) 87 | goku_reye.lt(115) 88 | goku_reye.fd(17) 89 | e1 = goku_reye.pos() 90 | goku_reye.fd(40) 91 | goku_reye.goto(e) 92 | goku_reye.end_fill() 93 | goku_reye.goto(e1) 94 | goku_reye.color("black","white") 95 | goku_reye.begin_fill() 96 | goku_reye.rt(70) 97 | goku_reye.fd(17) 98 | goku_reye.lt(85) 99 | goku_reye.fd(37) 100 | goku_reye.end_fill() 101 | goku_reye.begin_fill() 102 | goku_reye.color("black") 103 | goku_reye.circle(5) 104 | goku_reye.end_fill() 105 | goku_reye.hideturtle() 106 | 107 | #Code for drawing left eye of Goku 108 | goku_leye = turtle.Turtle() 109 | goku_leye.speed(20) 110 | goku_leye.penup() 111 | goku_leye.goto(-150,-20) 112 | goku_leye.pendown() 113 | goku_leye.left(125) 114 | goku_leye.backward(5) 115 | e = goku_leye.pos() 116 | goku_leye.lt(90) 117 | goku_leye.begin_fill() 118 | goku_leye.bk(60) 119 | goku_leye.rt(70) 120 | goku_leye.bk(10) 121 | goku_leye.rt(115) 122 | goku_leye.bk(17) 123 | e1 = goku_leye.pos() 124 | goku_leye.bk(40) 125 | goku_leye.goto(e) 126 | goku_leye.end_fill() 127 | goku_leye.goto(e1) 128 | goku_leye.color("black","white") 129 | goku_leye.begin_fill() 130 | goku_leye.lt(70) 131 | goku_leye.bk(17) 132 | goku_leye.rt(85) 133 | goku_leye.bk(37) 134 | goku_leye.end_fill() 135 | goku_leye.begin_fill() 136 | goku_leye.color("black") 137 | goku_leye.circle(5) 138 | goku_leye.end_fill() 139 | goku_leye.hideturtle() 140 | 141 | 142 | #face of goku 143 | goku_face = turtle.Turtle() 144 | goku_face.speed(20) 145 | goku_face.penup() 146 | goku_face.goto(-270,10) 147 | goku_face.pendown() 148 | goku_face.rt(65) 149 | goku_face.fd(100) 150 | goku_face.left(30) 151 | goku_face.fd(80) 152 | goku_face.lt(70) 153 | goku_face.fd(80) 154 | goku_face.left(30) 155 | goku_face.fd(109) 156 | goku_face.hideturtle() 157 | 158 | #code for nose of goku 159 | goku_nose = turtle.Turtle() 160 | goku_nose.speed(20) 161 | goku_nose.penup() 162 | goku_nose.goto(-165,-50) 163 | goku_nose.pendown() 164 | goku_nose.right(90) 165 | goku_nose.fd(15) 166 | goku_nose.hideturtle() 167 | 168 | #Code for smile of goku 169 | goku_smile=turtle.Turtle() 170 | goku_smile.speed(20) 171 | goku_smile.penup() 172 | goku_smile.goto(-185,-75) 173 | goku_smile.pendown() 174 | goku_smile.rt(55) 175 | goku_smile.fd(10) 176 | goku_smile.lt(60) 177 | goku_smile.fd(30) 178 | goku_smile.lt(60) 179 | goku_smile.fd(10) 180 | goku_smile.penup() 181 | goku_smile.goto(-170,-90) 182 | goku_smile.pendown() 183 | goku_smile.rt(60) 184 | goku_smile.fd(15) 185 | goku_smile.hideturtle() 186 | 187 | #code for the sword 188 | 189 | #go to starting position 190 | goku_sword = turtle.Turtle() 191 | goku_sword.speed(20) 192 | goku_sword.penup() 193 | goku_sword.goto(270,-80) 194 | goku_sword.right(90) 195 | goku_sword.forward(150) 196 | goku_sword.right(90) 197 | goku_sword.forward(130) 198 | 199 | #end of handle 200 | goku_sword.pendown() 201 | goku_sword.right(90) 202 | goku_sword.forward(50) 203 | goku_sword.right(90) 204 | goku_sword.forward(50) 205 | goku_sword.right(90) 206 | goku_sword.forward(50) 207 | goku_sword.right(90) 208 | goku_sword.forward(50) 209 | goku_sword.end_fill() 210 | 211 | #right handle 212 | goku_sword.right(180) 213 | goku_sword.forward(50) 214 | goku_sword.left(90) 215 | goku_sword.forward(15) 216 | goku_sword.right(45) 217 | goku_sword.forward(75) 218 | goku_sword.right(90) 219 | goku_sword.forward(50) 220 | goku_sword.left(45) 221 | goku_sword.forward(75) 222 | goku_sword.left(135) 223 | goku_sword.forward(75) 224 | 225 | #right blade 226 | goku_sword.right(90) 227 | goku_sword.forward(200) 228 | goku_sword.left(45) 229 | goku_sword.forward(75) 230 | 231 | #left blade 232 | goku_sword.left(90) 233 | goku_sword.forward(75) 234 | goku_sword.left(45) 235 | goku_sword.forward(200) 236 | 237 | 238 | #left handle 239 | goku_sword.right(90) 240 | goku_sword.forward(75) 241 | goku_sword.left(135) 242 | goku_sword.forward(75) 243 | goku_sword.left(45) 244 | goku_sword.forward(50) 245 | goku_sword.right(90) 246 | goku_sword.forward(75) 247 | 248 | #decoration on end of handle 249 | goku_sword.left(45) 250 | goku_sword.penup() 251 | goku_sword.forward(12) 252 | goku_sword.right(90) 253 | goku_sword.forward(3) 254 | goku_sword.left(90) 255 | goku_sword.pendown() 256 | goku_sword.begin_fill() 257 | goku_sword.fillcolor("#fcc201") 258 | goku_sword.forward(25) 259 | goku_sword.left(90) 260 | goku_sword.forward(25) 261 | goku_sword.left(90) 262 | goku_sword.forward(25) 263 | goku_sword.left(90) 264 | goku_sword.forward(25) 265 | goku_sword.left(90) 266 | goku_sword.left(135) 267 | goku_sword.end_fill() 268 | #left decoration on handle 269 | 270 | goku_sword.penup() 271 | goku_sword.forward(100) 272 | goku_sword.left(90) 273 | goku_sword.forward(10) 274 | goku_sword.pendown() 275 | goku_sword.begin_fill() 276 | goku_sword.fillcolor("red") 277 | goku_sword.forward(45) 278 | goku_sword.right(45) 279 | goku_sword.forward(35) 280 | goku_sword.right(135) 281 | goku_sword.forward(45) 282 | goku_sword.right(45) 283 | goku_sword.forward(35) 284 | goku_sword.end_fill() 285 | 286 | #right decoration on handle 287 | goku_sword.left(45) 288 | goku_sword.penup() 289 | goku_sword.forward(50) 290 | goku_sword.pendown() 291 | goku_sword.begin_fill() 292 | goku_sword.fillcolor("red") 293 | goku_sword.forward(45) 294 | goku_sword.left(45) 295 | goku_sword.forward(35) 296 | goku_sword.left(135) 297 | goku_sword.forward(45) 298 | goku_sword.left(45) 299 | goku_sword.forward(35) 300 | goku_sword.end_fill() 301 | goku_sword.penup() 302 | 303 | #beginning of blade decoration 304 | goku_sword.right(45) 305 | goku_sword.forward(22) 306 | goku_sword.right(90) 307 | 308 | #blade decoration 309 | goku_sword.pendown() 310 | 311 | goku_sword.right(45) 312 | goku_sword.forward(55) 313 | goku_sword.left(45) 314 | goku_sword.forward(195) 315 | goku_sword.left(45) 316 | goku_sword.forward(55) 317 | goku_sword.left(90) 318 | goku_sword.forward(55) 319 | goku_sword.left(45) 320 | goku_sword.forward(195) 321 | goku_sword.left(45) 322 | goku_sword.forward(55) 323 | goku_sword.right(45) 324 | goku_sword.penup() 325 | 326 | #blade decoration 2 327 | goku_sword.right(180) 328 | goku_sword.forward(20) 329 | goku_sword.pendown() 330 | goku_sword.begin_fill() 331 | goku_sword.fillcolor("#fcc201") 332 | goku_sword.right(45) 333 | goku_sword.forward(35) 334 | goku_sword.left(45) 335 | goku_sword.forward(185) 336 | goku_sword.left(45) 337 | goku_sword.forward(35) 338 | goku_sword.left(90) 339 | goku_sword.forward(35) 340 | goku_sword.left(45) 341 | goku_sword.forward(185) 342 | goku_sword.left(45) 343 | goku_sword.forward(35) 344 | goku_sword.end_fill() 345 | goku_sword.penup() 346 | goku_sword.right(45) 347 | 348 | #handle decoration middle 349 | goku_sword.forward(35) 350 | goku_sword.pendown() 351 | goku_sword.begin_fill() 352 | goku_sword.fillcolor("blue") 353 | goku_sword.right(45) 354 | goku_sword.forward(15) 355 | goku_sword.left(45) 356 | goku_sword.forward(35) 357 | goku_sword.left(135) 358 | goku_sword.forward(16) 359 | goku_sword.right(90) 360 | goku_sword.forward(16) 361 | goku_sword.left(135) 362 | goku_sword.forward(35) 363 | goku_sword.left(45) 364 | goku_sword.forward(15) 365 | goku_sword.end_fill() 366 | goku_sword.penup() 367 | goku_sword.hideturtle() 368 | 369 | 370 | 371 | turtle.hideturtle() 372 | 373 | #code for holding screen 374 | turtle.mainloop() -------------------------------------------------------------------------------- /happy_diwali.py: -------------------------------------------------------------------------------- 1 | # Import TURTLE LIBRARY and RANDOM & TIME MODULE using the command: 2 | import turtle 3 | import random 4 | import time 5 | 6 | # You have to create your own window to run each drawing command. You can do this by initializing variables. 7 | 8 | t = turtle.Turtle() 9 | s = turtle.Screen() 10 | w = turtle.title("diwali") 11 | 12 | # Setting up the screen’s height and width (Here we have both height and width equals to 1 so, we will get a full screen.) 13 | 14 | s.setup(width=1.0, height=1.0) 15 | s.colormode(255) 16 | 17 | # Giving screen a background colour 18 | 19 | turtle.Screen().bgcolor("Black") 20 | 21 | # setting colour of pen 22 | 23 | t.pencolor('yellow') 24 | 25 | # speed refers to the speed of the pen here, 0 is the max speed and 1 is minimum speed. 26 | t.speed(0) 27 | 28 | # This will help us to hide the cursor of the turtle. 29 | t.hideturtle() 30 | 31 | # This determines the width of the pen. 32 | t.pensize(4) 33 | 34 | # This will create a rangoli design for our animation. 35 | '''This function will create 10 circles, 36 | and each time radius will be reduced to radius-4 ''' 37 | 38 | 39 | def draw(radius): 40 | for i in range(10): 41 | t.circle(radius) 42 | radius = radius-4 43 | 44 | 45 | '''This function will call draw function 10 times 46 | and everytime the turtle will change its direction''' 47 | 48 | 49 | def design(): 50 | for i in range(10): 51 | draw(120) 52 | t.right(36) 53 | t.penup() 54 | 55 | 56 | design() 57 | 58 | 59 | # This function will create a rocket cracker. 60 | def rocket(): 61 | 62 | t.hideturtle() 63 | # setting position of the head of the rocket which is a triangle 64 | t.setpos(-510, -180) 65 | t.color('yellow') # colour of the outine of the head 66 | t.pendown() 67 | t.begin_fill() # this will fill the colour in triangle shape(head). 68 | for count in range(3): 69 | t.fd(50) 70 | t.lt(120) 71 | t.end_fill() 72 | t.penup() # stops drawing on the screen. 73 | t.pendown() # This will again start drawing 74 | '''This will create a rectangle shape 75 | as the body of the rocket''' 76 | t.color('red') 77 | t.begin_fill() 78 | t.fd(50) 79 | t.rt(90) 80 | t.fd(80) 81 | t.rt(90) 82 | t.fd(50) 83 | t.rt(90) 84 | t.fd(80) 85 | t.end_fill() 86 | t.penup() 87 | t.setpos(-470, -350) 88 | t.speed(0) 89 | '''This will create the stick of the rocket''' 90 | t.pendown() 91 | t.color('brown') 92 | t.begin_fill() 93 | t.fd(100) 94 | t.rt(90) 95 | t.fd(2) 96 | t.rt(90) 97 | t.fd(100) 98 | t.rt(90) 99 | t.fd(2) 100 | t.end_fill() 101 | t.penup() 102 | t.penup() 103 | t.setpos(-495, -283) 104 | t.speed(0) 105 | t.pensize(3) 106 | 107 | '''This will draw the part where we lit''' 108 | t.pendown() 109 | t.color('brown') 110 | t.begin_fill() 111 | t.fd(3) 112 | t.rt(90) 113 | t.fd(20) 114 | t.rt(90) 115 | t.fd(3) 116 | t.rt(90) 117 | t.fd(20) 118 | t.end_fill() 119 | t.penup() 120 | t.pendown() 121 | 122 | '''This will create a fire like structure at the rocket''' 123 | Radius = 10 124 | t.pensize(1) 125 | x_coord = (-500) 126 | y_coord = (-290) 127 | t.penup() 128 | t.setpos(x_coord, y_coord) 129 | t.pendown() 130 | t.pencolor('yellow') 131 | for i in range(5): 132 | t.fd(Radius) 133 | t.backward(2*Radius) 134 | t.fd(Radius) 135 | t.right(20) 136 | 137 | 138 | rocket() 139 | 140 | 141 | # Function to draw crackers 142 | 143 | def crackers(): 144 | # it randomly selects radius between the given values 145 | Radius = random.randint(80, 180) 146 | x_coord = (400) 147 | y_coord = (350) 148 | t.penup() 149 | t.setpos(x_coord, y_coord) # sets the position of the cracker's center 150 | t.pendown() 151 | t.pencolor('blue') 152 | for i in range(20): 153 | t.fd(Radius) 154 | t.backward(2*Radius) 155 | t.fd(Radius) 156 | t.right(10) 157 | 158 | Radius = random.randint(80, 180) 159 | x_coord = (360) 160 | y_coord = (250) 161 | t.penup() 162 | t.setpos(x_coord, y_coord) 163 | t.pendown() 164 | t.pencolor('red') 165 | for i in range(20): 166 | t.fd(Radius) 167 | t.backward(2*Radius) 168 | t.fd(Radius) 169 | t.right(10) 170 | 171 | Radius = random.randint(80, 180) 172 | x_coord = (560) 173 | y_coord = (130) 174 | t.penup() 175 | t.setpos(x_coord, y_coord) 176 | t.pendown() 177 | t.pencolor('pink') 178 | for i in range(20): 179 | t.fd(Radius) 180 | t.backward(2*Radius) 181 | t.fd(Radius) 182 | t.right(10) 183 | 184 | Radius = random.randint(80, 180) 185 | x_coord = (-360) 186 | y_coord = (180) 187 | t.penup() 188 | t.setpos(x_coord, y_coord) 189 | t.pendown() 190 | t.pencolor('orange') 191 | for i in range(20): 192 | t.fd(Radius) 193 | t.backward(2*Radius) 194 | t.fd(Radius) 195 | t.right(10) 196 | 197 | Radius = random.randint(80, 180) 198 | x_coord = (-480) 199 | y_coord = (120) 200 | t.penup() 201 | t.setpos(x_coord, y_coord) 202 | t.pendown() 203 | t.pencolor('purple') 204 | for i in range(20): 205 | t.fd(Radius) 206 | t.backward(2*Radius) 207 | t.fd(Radius) 208 | t.right(10) 209 | 210 | Radius = random.randint(70, 120) 211 | x_coord = (-530) 212 | y_coord = (380) 213 | t.penup() 214 | t.setpos(x_coord, y_coord) 215 | t.pendown() 216 | t.pencolor('yellow') 217 | for i in range(20): 218 | t.fd(Radius) 219 | t.backward(2*Radius) 220 | t.fd(Radius) 221 | t.right(10) 222 | 223 | Radius = random.randint(50, 100) 224 | x_coord = (540) 225 | y_coord = (350) 226 | t.penup() 227 | t.setpos(x_coord, y_coord) 228 | t.pendown() 229 | t.pencolor('orange') 230 | for i in range(20): 231 | t.fd(Radius) 232 | t.backward(2*Radius) 233 | t.fd(Radius) 234 | t.right(10) 235 | 236 | Radius = random.randint(80, 180) 237 | x_coord = (-530) 238 | y_coord = (150) 239 | t.penup() 240 | t.setpos(x_coord, y_coord) 241 | t.pendown() 242 | t.pencolor('green') 243 | for i in range(20): 244 | t.fd(Radius) 245 | t.backward(2*Radius) 246 | t.fd(Radius) 247 | t.right(10) 248 | 249 | 250 | crackers() 251 | # Functions to display HAPPY DIWALI 252 | 253 | 254 | def h(): 255 | t.penup() 256 | t.setpos(-300, 200) 257 | t.pendown() 258 | t.left(90) 259 | t.forward(100) 260 | t.right(180) 261 | t.forward(50) 262 | t.left(90) 263 | t.forward(50) 264 | t.left(90) 265 | t.forward(50) 266 | t.right(180) 267 | t.fd(100) 268 | 269 | 270 | def a1(): 271 | t.penup() 272 | t.setpos(-200, 200) 273 | t.pendown() 274 | t.left(90) 275 | t.left(60) 276 | t.forward(100) 277 | t.right(120) 278 | t.forward(50) 279 | t.right(120) 280 | t.forward(50) 281 | t.right(180) 282 | t.fd(50) 283 | t.right(60) 284 | t.fd(50) 285 | 286 | 287 | def p1(): 288 | t.penup() 289 | t.setpos(-50, 200) 290 | t.pendown() 291 | t.left(150) 292 | t.fd(80) 293 | t.right(180) 294 | t.circle(25) 295 | 296 | 297 | def p2(): 298 | t.penup() 299 | t.setpos(50, 200) 300 | t.pendown() 301 | t.left(180) 302 | t.fd(80) 303 | t.right(180) 304 | t.circle(25) 305 | 306 | 307 | def y(): 308 | t.penup() 309 | t.setpos(150, 200) 310 | t.pendown() 311 | t.left(150) 312 | t.fd(110) 313 | t.right(180) 314 | t.fd(60) 315 | t.right(120) 316 | t.fd(60) 317 | t.right(180) 318 | t.fd(60) 319 | t.right(60) 320 | t.fd(50) 321 | t.left(120) 322 | 323 | 324 | def d(): 325 | t.penup() 326 | t.setpos(-350, -300) 327 | t.pendown() 328 | t.left(90) 329 | t.fd(100) 330 | t.right(90) 331 | t.circle(-50, 180, 30) 332 | t.right(180) 333 | 334 | 335 | def i1(): 336 | t.penup() 337 | t.setpos(-250, -300) 338 | t.pendown() 339 | t.fd(50) 340 | t.left(180) 341 | t.fd(25) 342 | t.right(90) 343 | t.fd(100) 344 | t.right(90) 345 | t.fd(25) 346 | t.backward(50) 347 | 348 | 349 | def w(): 350 | t.penup() 351 | t.setpos(-150, -200) 352 | t.pendown() 353 | t.right(90) 354 | t.fd(100) 355 | t.left(135) 356 | t.fd(50) 357 | t.right(90) 358 | t.fd(50) 359 | t.left(135) 360 | t.fd(100) 361 | t.right(180) 362 | t.fd(100) 363 | 364 | 365 | def a2(): 366 | t.penup() 367 | t.setpos(-50, -300) 368 | t.pendown() 369 | t.left(90) 370 | t.left(60) 371 | t.forward(100) 372 | t.right(120) 373 | t.forward(50) 374 | t.right(120) 375 | t.forward(50) 376 | t.right(180) 377 | t.fd(50) 378 | t.right(60) 379 | t.fd(50) 380 | 381 | 382 | def l(): 383 | t.penup() 384 | t.setpos(100, -300) 385 | t.pendown() 386 | t.left(150) 387 | t.fd(100) 388 | t.right(180) 389 | t.fd(100) 390 | t.left(90) 391 | t.fd(60) 392 | 393 | 394 | def i2(): 395 | t.penup() 396 | t.setpos(200, -300) 397 | t.pendown() 398 | t.fd(50) 399 | t.left(180) 400 | t.fd(25) 401 | t.right(90) 402 | t.fd(100) 403 | t.right(90) 404 | t.fd(25) 405 | t.backward(50) 406 | 407 | 408 | t.setheading(0) 409 | t.color("white") 410 | t.pensize(10) 411 | 412 | h() 413 | a1() 414 | p1() 415 | p2() 416 | y() 417 | d() 418 | i1() 419 | w() 420 | a2() 421 | l() 422 | i2() 423 | t.hideturtle() 424 | 425 | time.sleep(2) 426 | t.penup() 427 | 428 | # And our program is ready!!! Let's run it and see the output 429 | turtle.done -------------------------------------------------------------------------------- /micky-mouse.py: -------------------------------------------------------------------------------- 1 | #draw mickey mouse using turtle 2 | 3 | #importing necessary modules 4 | from tkinter import N 5 | import turtle 6 | import colorsys 7 | 8 | #Initialize a variable for turtle 9 | micky_mouse = turtle.Turtle() 10 | micky_mouse.speed(0) 11 | 12 | #Create a turtle screen 13 | screen= turtle.Screen() 14 | #Define height and width of screen 15 | screen.setup(1200,600) 16 | #Define Background color of screen 17 | screen.bgcolor('#ffdbac') 18 | screen.update() 19 | 20 | 21 | # Define title of program 22 | turtle.title("Copy Assignment Turtle") 23 | 24 | 25 | #Code for drawing head of mickey mouse 26 | 27 | #initializing starting point of head 28 | micky_mouse.goto(0,-150) 29 | #filling color in head 30 | micky_mouse.begin_fill() 31 | #setting color of head 32 | micky_mouse.color('black') 33 | #drawing head 34 | micky_mouse.circle(150) 35 | #ending fill 36 | micky_mouse.end_fill() 37 | 38 | 39 | #Code for drawing ears of mickey mouse 40 | 41 | #left ear 42 | #initializing starting point of left ear 43 | micky_mouse.goto(-120,100) 44 | #filling color in left ear 45 | micky_mouse.begin_fill() 46 | #setting color of left ear 47 | micky_mouse.color('black') 48 | #drawing left ear 49 | micky_mouse.circle(90) 50 | #ending fill 51 | micky_mouse.end_fill() 52 | 53 | #right ear 54 | #initializing starting point of right ear 55 | micky_mouse.goto(120,100) 56 | #filling color in right ear 57 | micky_mouse.begin_fill() 58 | #setting color of right ear 59 | micky_mouse.color('black') 60 | #drawing right ear 61 | micky_mouse.circle(90) 62 | #ending fill 63 | micky_mouse.end_fill() 64 | 65 | 66 | 67 | #Code for drawing face of mickey mouse 68 | 69 | #initializing starting point of face dip 70 | micky_mouse.goto(40,-190) 71 | #filling color in face dip 72 | micky_mouse.begin_fill() 73 | #setting color of face dip 74 | micky_mouse.color('#ffdbac') 75 | #drawing face dip 76 | micky_mouse.circle(120) 77 | #ending fill 78 | micky_mouse.end_fill() 79 | 80 | micky_mouse.goto(-40,-190) 81 | micky_mouse.begin_fill() 82 | micky_mouse.color('#ffdbac') 83 | micky_mouse.circle(120) 84 | micky_mouse.end_fill() 85 | 86 | #Code for face outline 87 | 88 | #initializing starting point of face outline 89 | micky_mouse.goto(0,-150) 90 | #setting color of face outline 91 | micky_mouse.color('black') 92 | #drawing face outline 93 | micky_mouse.circle(150) 94 | 95 | 96 | 97 | #Code for drawing eyes of mickey mouse 98 | 99 | #initializing starting point of left eye 100 | micky_mouse.penup() 101 | micky_mouse.goto(-50,-25) 102 | micky_mouse.pendown() 103 | 104 | def draw_left_eye(rad): 105 | for i in range(4): 106 | 107 | # two arcs 108 | #filling color in eyes 109 | micky_mouse.begin_fill() 110 | #setting color of eyes 111 | micky_mouse.color('white') 112 | #DRAW eyes 113 | micky_mouse.circle(rad,90) 114 | micky_mouse.circle(rad//4,90) 115 | #ending fill 116 | micky_mouse.end_fill() 117 | 118 | # Main section 119 | # tilt the shape to negative 45 120 | micky_mouse.seth(45) 121 | draw_left_eye(40) 122 | 123 | 124 | #Code of left eye ball 125 | micky_mouse.penup() 126 | micky_mouse.goto(-50,-20) 127 | micky_mouse.pendown() 128 | #filling color in left eye 129 | micky_mouse.begin_fill() 130 | #setting color of left eye 131 | micky_mouse.color('black') 132 | #drawing left eye 133 | micky_mouse.circle(8) 134 | #ending fill 135 | micky_mouse.end_fill() 136 | 137 | #initializing starting point of right eye 138 | 139 | micky_mouse.penup() 140 | micky_mouse.goto(55,-25) 141 | micky_mouse.pendown() 142 | 143 | def draw_eye(rad): 144 | for i in range(4): 145 | 146 | # two arcs 147 | #filling color in eyes 148 | micky_mouse.begin_fill() 149 | #setting color of eyes 150 | micky_mouse.color('white') 151 | #DRAW eyes 152 | micky_mouse.circle(rad,90) 153 | micky_mouse.circle(rad//4,90) 154 | #ending fill 155 | micky_mouse.end_fill() 156 | 157 | # Main section 158 | # tilt the shape to negative 45 159 | micky_mouse.seth(45) 160 | draw_eye(40) 161 | 162 | # code for right eye ball 163 | micky_mouse.penup() 164 | micky_mouse.goto(50,-20) 165 | micky_mouse.pendown() 166 | #filling color in right eye 167 | micky_mouse.begin_fill() 168 | #setting color of right eye 169 | micky_mouse.color('black') 170 | #drawing right eye 171 | micky_mouse.circle(8) 172 | #ending fill 173 | micky_mouse.end_fill() 174 | 175 | #Code for drawing outline of eyes of mickey mouse 176 | #initializing starting point of right eye outline 177 | micky_mouse.penup() 178 | micky_mouse.goto(55,-25) 179 | micky_mouse.pendown() 180 | 181 | def draw_reye_outline(rad): 182 | for i in range(4): 183 | 184 | # two arcs 185 | micky_mouse.circle(rad,90) 186 | micky_mouse.circle(rad//4,90) 187 | 188 | # Main section 189 | # tilt the shape to negative 45 190 | micky_mouse.seth(45) 191 | draw_reye_outline(40) 192 | 193 | #initializing starting point of left eye outline 194 | micky_mouse.penup() 195 | micky_mouse.goto(-50,-25) 196 | micky_mouse.pendown() 197 | 198 | def draw_leye_outline(rad): 199 | for i in range(4): 200 | 201 | # two arcs 202 | micky_mouse.circle(rad,90) 203 | micky_mouse.circle(rad//4,90) 204 | 205 | # Main section 206 | # tilt the shape to negative 45 207 | micky_mouse.seth(45) 208 | draw_leye_outline(40) 209 | 210 | 211 | 212 | #Code for drawing nose of mickey mouse 213 | 214 | #initializing starting point of nose 215 | micky_mouse.penup() 216 | micky_mouse.goto(-20,-50) 217 | micky_mouse.pendown() 218 | def draw(rad): 219 | for i in range(3): 220 | 221 | # two arcs 222 | #filling color in nose 223 | micky_mouse.begin_fill() 224 | #setting color of nose 225 | micky_mouse.color('black') 226 | #DRAW NOSE 227 | micky_mouse.circle(rad,90) 228 | micky_mouse.circle(rad//3,90) 229 | #ending fill 230 | micky_mouse.end_fill() 231 | 232 | # Main section 233 | # tilt the shape to negative 45 234 | micky_mouse.seth(-45) 235 | draw(25) 236 | 237 | #speed of turtle 238 | micky_mouse.speed(3) 239 | 240 | 241 | #Code for drawing lips of mickey mouse 242 | 243 | #initializing starting point of lips 244 | micky_mouse.speed(0) 245 | micky_mouse.penup() 246 | micky_mouse.goto(-48,-78) 247 | micky_mouse.pendown() 248 | #direction of turtle 249 | micky_mouse.right(90) 250 | #setting heading of turtle 251 | micky_mouse.setheading(-50) 252 | #drawing lips 253 | for x in range (110): 254 | micky_mouse.forward(1) 255 | micky_mouse.left(1) 256 | # micky_mouse.left(110) 257 | # micky_mouse.forward(110) 258 | # micky_mouse.end_fill() 259 | micky_mouse.speed(0) 260 | 261 | #Code for drawing eyebrows of mickey mouse 262 | 263 | 264 | micky_mouse.setheading(-155) 265 | #setting color of left eyebrow 266 | micky_mouse.color('black') 267 | #intialze pen thickness 268 | micky_mouse.pensize(2) 269 | micky_mouse.penup() 270 | #initializing starting point of left eyebrow 271 | micky_mouse.goto(-40,-70) 272 | micky_mouse.pendown() 273 | #drawing left eyebrow 274 | micky_mouse.circle(30,40) 275 | #hide turtle 276 | micky_mouse.hideturtle() 277 | 278 | 279 | #code for drawing right eyebrow 280 | micky_mouse.setheading(-245) 281 | #setting color of right eyebrow 282 | micky_mouse.color('black') 283 | #intialze pen thickness 284 | micky_mouse.pensize(2) 285 | micky_mouse.penup() 286 | #initializing starting point of right eyebrow 287 | micky_mouse.goto(50,-80) 288 | micky_mouse.pendown() 289 | #drawing right eyebrow 290 | micky_mouse.circle(30,40) 291 | #hide turtle 292 | micky_mouse.hideturtle() 293 | 294 | #Code for drawing tongue of mickey mouse 295 | micky_mouse.pensize(1) 296 | micky_mouse.penup() 297 | micky_mouse.goto(-33,-92) 298 | micky_mouse.pendown() 299 | #direction of turtle 300 | micky_mouse.right(90) 301 | #setting heading of turtle 302 | micky_mouse.setheading(-45) 303 | #drawing lips 304 | micky_mouse.forward(20) 305 | micky_mouse.circle(25,95) 306 | micky_mouse.forward(20) 307 | 308 | #Code for background pattern 309 | 310 | #Code for first pattern 311 | h=0 312 | n=50 313 | micky_mouse.pensize(3) 314 | for i in range (50): 315 | c = colorsys.hsv_to_rgb(h, 1.0, 0.8) 316 | h+=1/n 317 | micky_mouse.penup() 318 | #initializing starting point of background pattern 319 | micky_mouse.goto(500,200) 320 | micky_mouse.pendown() 321 | micky_mouse.hideturtle() 322 | #setting color of background pattern 323 | micky_mouse.pencolor(c) 324 | #drawing background pattern 325 | micky_mouse.circle(i,90) 326 | #moving turtle in forward direction 327 | micky_mouse.forward(i) 328 | #moving turtle in right direction 329 | micky_mouse.right(270) 330 | micky_mouse.circle(i,270) 331 | micky_mouse.forward(i) 332 | micky_mouse.right(180) 333 | micky_mouse.speed(0) 334 | 335 | #Code for second pattern 336 | for i in range (50): 337 | c = colorsys.hsv_to_rgb(h, 1.0, 0.8) 338 | h+=1/n 339 | micky_mouse.penup() 340 | micky_mouse.goto(-500,200) 341 | micky_mouse.pendown() 342 | micky_mouse.hideturtle() 343 | micky_mouse.pencolor(c) 344 | micky_mouse.circle(i,90) 345 | micky_mouse.forward(i) 346 | micky_mouse.right(270) 347 | micky_mouse.circle(i,270) 348 | micky_mouse.forward(i) 349 | micky_mouse.right(180) 350 | micky_mouse.speed(0) 351 | 352 | #Code for third pattern 353 | for i in range (50): 354 | c = colorsys.hsv_to_rgb(h, 1.0, 0.8) 355 | h+=1/n 356 | micky_mouse.penup() 357 | micky_mouse.goto(500,-200) 358 | micky_mouse.pendown() 359 | micky_mouse.hideturtle() 360 | micky_mouse.pencolor(c) 361 | micky_mouse.circle(i,90) 362 | micky_mouse.forward(i) 363 | micky_mouse.right(270) 364 | micky_mouse.circle(i,270) 365 | micky_mouse.forward(i) 366 | micky_mouse.right(180) 367 | micky_mouse.speed(0) 368 | 369 | #Code for fourth pattern 370 | for i in range (50): 371 | c = colorsys.hsv_to_rgb(h, 1.0, 0.8) 372 | h+=1/n 373 | micky_mouse.penup() 374 | micky_mouse.goto(-500,-200) 375 | micky_mouse.pendown() 376 | micky_mouse.hideturtle() 377 | micky_mouse.pencolor(c) 378 | micky_mouse.circle(i,90) 379 | micky_mouse.forward(i) 380 | micky_mouse.right(270) 381 | micky_mouse.circle(i,270) 382 | micky_mouse.forward(i) 383 | micky_mouse.right(180) 384 | micky_mouse.speed(0) 385 | turtle.done() 386 | 387 | #code for holding the output screen 388 | turtle.mainloop() -------------------------------------------------------------------------------- /shinchan.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | #import time 3 | s=Screen() 4 | s.screensize(700,1000) 5 | speed(5) 6 | def myPosition(x, y): 7 | penup() 8 | goto(x, y) 9 | pendown() 10 | #time.sleep(10) 11 | #ht() 12 | pensize(2) 13 | def hulk(): 14 | fillcolor('#ffec40') 15 | begin_fill() 16 | right(25) 17 | forward(20) 18 | right(45) 19 | forward(20) 20 | left(70) 21 | forward(90) 22 | left(95) 23 | forward(75) 24 | left(85) 25 | forward(175) 26 | left(85) 27 | forward(75) 28 | left(95) 29 | forward(90) 30 | left(85) 31 | forward(18) 32 | end_fill() 33 | 34 | def leftLeg(): 35 | myPosition(-39,-25) 36 | fillcolor("#ffd699") 37 | begin_fill() 38 | right(89) 39 | forward(25) 40 | right(90) 41 | forward(50) 42 | right(90) 43 | forward(20) 44 | right(85) 45 | forward(50) 46 | end_fill() 47 | 48 | def leftSock(): 49 | myPosition(-36,-78) 50 | fillcolor("#ffffff") 51 | begin_fill() 52 | right(90) 53 | circle(80,13) 54 | right(110) 55 | forward(22) 56 | right(85) 57 | forward(19) 58 | right(90) 59 | forward(21) 60 | end_fill() 61 | 62 | def leftShoe(): 63 | myPosition(-69,-112) 64 | fillcolor("#b5ae60") 65 | begin_fill() 66 | right(90) 67 | left(5) 68 | forward(56) 69 | left(105) 70 | forward(13) 71 | left(75) 72 | forward(20) 73 | right(90) 74 | forward(15) 75 | circle(10,15) 76 | left(80) 77 | forward(4) 78 | circle(10,15) 79 | left(40) 80 | circle(20,15) 81 | forward(10) 82 | right(45) 83 | forward(15) 84 | circle(25,25) 85 | end_fill() 86 | 87 | def rightLeg(): 88 | myPosition(60,-28) 89 | fillcolor("#ffd699") 90 | begin_fill() 91 | #right(90) 92 | left(128) 93 | forward(25) 94 | right(95) 95 | forward(55) 96 | right(90) 97 | forward(20) 98 | right(85) 99 | forward(55) 100 | end_fill() 101 | 102 | def rightSock(): 103 | myPosition(64,-79) 104 | fillcolor("#ffffff") 105 | begin_fill() 106 | right(90) 107 | circle(90,14) 108 | right(110) 109 | forward(23) 110 | right(90) 111 | forward(15) 112 | right(80) 113 | forward(21) 114 | end_fill() 115 | 116 | def rightShoe(): 117 | myPosition(64,-108) 118 | fillcolor("#b5ae60") 119 | begin_fill() 120 | right(100) 121 | forward(56) 122 | left(160) 123 | forward(25) 124 | right(68) 125 | forward(17) 126 | left(90) 127 | circle(18,15) 128 | forward(5) 129 | left(75) 130 | forward(11) 131 | right(85) 132 | forward(20) 133 | left(45) 134 | circle(10,30) 135 | left(25) 136 | forward(5) 137 | end_fill() 138 | 139 | def myShirt(): 140 | myPosition(-75,48) 141 | fillcolor("red") 142 | begin_fill() 143 | left(72) 144 | forward(185) 145 | left(87) 146 | forward(75) 147 | right(68) 148 | circle(20,8) 149 | circle(300,23) 150 | left(90) 151 | circle(35,17) 152 | right(38) 153 | circle(35,17) 154 | left(58) 155 | forward(75) 156 | right(12) 157 | forward(140) 158 | right(40) 159 | forward(93) 160 | left(120) 161 | circle(-20,65) 162 | left(75) 163 | forward(10) 164 | left(23) 165 | forward(88) 166 | #circle(-80,10) 167 | right(31) 168 | forward(87) 169 | right(180) 170 | forward(108) 171 | right(180) 172 | forward(104) 173 | circle(10,70) 174 | end_fill() 175 | 176 | def myHead(): 177 | myPosition(-20,295) 178 | left(20) 179 | pensize(2) 180 | fillcolor('#fcc6a0') 181 | begin_fill() 182 | right(90) 183 | forward(40) 184 | right(90) 185 | circle(50,80) 186 | left(10) 187 | circle(50,80) 188 | left(2) 189 | circle(200,50) 190 | 191 | left(48) 192 | forward(60) 193 | #left(20) 194 | circle(45,60) 195 | right(5) 196 | circle(100,85) 197 | end_fill() 198 | fillcolor('black') 199 | begin_fill() 200 | 201 | pensize(2) 202 | right(170) 203 | circle(-100,165) 204 | right(78) 205 | forward(26) 206 | right(87) 207 | forward(55) 208 | circle(45,60) 209 | right(5) 210 | circle(100,85) 211 | end_fill() 212 | 213 | fillcolor('#fcc6a0') 214 | begin_fill() 215 | right(180) 216 | circle(-100,105) 217 | right(37) 218 | forward(49) 219 | pensize(2) 220 | left(130) 221 | forward(30) 222 | #right(5) 223 | circle(-10,70) 224 | right(50) 225 | #circle(10,10) 226 | forward(36) 227 | right(80) 228 | forward(50) 229 | pencolor('#fcc6a0') 230 | right(90) 231 | forward(30) 232 | 233 | end_fill() 234 | 235 | def rightHand(): 236 | #left(35) 237 | myPosition(197,209) 238 | pencolor('black') 239 | fillcolor('#fcc6a0') 240 | begin_fill() 241 | right(45) 242 | forward(6) 243 | left(55) 244 | forward(20) 245 | circle(-5,70) 246 | right(100) 247 | forward(18) 248 | left(105) 249 | forward(18) 250 | circle(-5,70) 251 | right(100) 252 | forward(18) 253 | left(145) 254 | forward(15) 255 | circle(-5,70) 256 | right(100) 257 | forward(18) 258 | 259 | left(150) 260 | forward(13) 261 | circle(-5,70) 262 | right(100) 263 | forward(15) 264 | 265 | left(150) 266 | forward(10) 267 | circle(-5,70) 268 | right(100) 269 | forward(12) 270 | circle(60,10) 271 | left(45) 272 | forward(6) 273 | right(90) 274 | forward(10) 275 | end_fill() 276 | 277 | def leftHand(): 278 | myPosition(-94,242) 279 | fillcolor('#fcc6a0') 280 | begin_fill() 281 | right(10) 282 | forward(6) 283 | left(90) 284 | penup() 285 | forward(12) 286 | pendown() 287 | left(90) 288 | forward(8) 289 | left(90) 290 | forward(12) 291 | end_fill() 292 | 293 | def myBis(): 294 | myPosition(-103,291) 295 | right(90) 296 | fillcolor('#02d302') 297 | begin_fill() 298 | right(90) 299 | forward(55) 300 | left(80) 301 | forward(12) 302 | left(10) 303 | forward(17) 304 | left(10) 305 | forward(12) 306 | left(80) 307 | forward(55) 308 | left(80) 309 | forward(12) 310 | left(10) 311 | forward(17) 312 | left(10) 313 | forward(12) 314 | left(80) 315 | left(80) 316 | forward(12) 317 | left(10) 318 | forward(17) 319 | left(10) 320 | forward(12) 321 | end_fill() 322 | penup() 323 | right(100) 324 | forward(20) 325 | right(90) 326 | forward(14) 327 | pendown() 328 | pencolor('#9c5e4a') 329 | fillcolor('#9c5e4a') 330 | begin_fill() 331 | for i in range(5): 332 | forward(15) 333 | right(144) 334 | end_fill() 335 | penup() 336 | forward(27) 337 | left(90) 338 | forward(16) 339 | left(90) 340 | forward(7) 341 | pendown() 342 | fillcolor('#9c5e4a') 343 | begin_fill() 344 | for i in range(5): 345 | forward(10) 346 | right(144) 347 | end_fill() 348 | penup() 349 | forward(20) 350 | right(90) 351 | forward(5) 352 | pendown() 353 | fillcolor('#9c5e4a') 354 | begin_fill() 355 | for i in range(5): 356 | forward(10) 357 | right(144) 358 | end_fill() 359 | penup() 360 | right(180) 361 | forward(6) 362 | pendown() 363 | fillcolor('#9c5e4a') 364 | begin_fill() 365 | for i in range(5): 366 | forward(10) 367 | right(144) 368 | end_fill() 369 | 370 | def leftHand2(): 371 | myPosition(-112,284) 372 | pencolor('black') 373 | fillcolor('#fcc6a0') 374 | begin_fill() 375 | right(180) 376 | forward(31) 377 | left(90) 378 | for i in range(2): 379 | circle(4,90) 380 | #circle(4//2,45) 381 | for i in range(3): 382 | right(180) 383 | for i in range(2): 384 | circle(4,90) 385 | end_fill() 386 | 387 | def myMouth(): 388 | myPosition(-25,200) 389 | left(65) 390 | fillcolor('#77332e') 391 | begin_fill() 392 | #circle(20) 393 | #forward(20) 394 | for i in range(2): 395 | circle(25,90) 396 | circle(25//2,90) 397 | end_fill() 398 | 399 | def myEyebrow(x,y): 400 | myPosition(x,y) 401 | pensize(18) 402 | right(150) 403 | forward(25) 404 | right(90) 405 | for i in range(1): 406 | right(45) 407 | dot(15) 408 | left(55) 409 | forward(25) 410 | for i in range(1): 411 | right(45) 412 | dot(15) 413 | 414 | def myEyelid(x,y): 415 | myPosition(x,y) 416 | pensize(2) 417 | left(170) 418 | circle(-23,180) 419 | 420 | def myallEyes1(x,y): 421 | myPosition(x,y) 422 | right(90) 423 | fillcolor('#000000') 424 | begin_fill() 425 | circle(18) 426 | end_fill() 427 | left(90) 428 | penup() 429 | forward(19) 430 | right(90) 431 | forward(7) 432 | pendown() 433 | fillcolor('#ffffff') 434 | begin_fill() 435 | left(90) 436 | circle(9) 437 | end_fill() 438 | 439 | def myallEyes2(x,y): 440 | myPosition(x,y) 441 | right(90) 442 | fillcolor('#000000') 443 | begin_fill() 444 | circle(18) 445 | end_fill() 446 | left(90) 447 | penup() 448 | forward(19) 449 | right(90) 450 | forward(8) 451 | pendown() 452 | fillcolor('#ffffff') 453 | begin_fill() 454 | left(90) 455 | circle(9) 456 | end_fill() 457 | 458 | def myRobot(): 459 | myPosition(155,-105) 460 | left(93) 461 | color('red') 462 | pensize(7) 463 | 464 | begin_fill() 465 | forward(50) 466 | left(90) 467 | forward(50) 468 | left(90) 469 | forward(50) 470 | left(90) 471 | forward(50) 472 | left(90) 473 | end_fill() 474 | 475 | 476 | color('white') 477 | penup() 478 | left(90) 479 | forward(30) 480 | right(90) 481 | forward(12) 482 | pendown() 483 | pensize(3) 484 | circle(5) 485 | penup() 486 | forward(25) 487 | pendown() 488 | circle(5) 489 | 490 | penup() 491 | right(90) 492 | forward(20) 493 | right(90) 494 | pendown() 495 | 496 | begin_fill() 497 | forward(23) 498 | right(90) 499 | forward(7) 500 | right(90) 501 | forward(23) 502 | right(90) 503 | forward(7) 504 | right(90) 505 | end_fill() 506 | 507 | penup() 508 | forward(25) 509 | right(90) 510 | forward(35) 511 | pendown() 512 | 513 | color('red') 514 | forward(30) 515 | penup() 516 | right(90) 517 | pendown() 518 | begin_fill() 519 | circle(5) 520 | end_fill() 521 | 522 | def allLegs(): 523 | leftLeg() 524 | leftSock() 525 | leftShoe() 526 | rightLeg() 527 | rightSock() 528 | rightShoe() 529 | def allHands(): 530 | rightHand() 531 | leftHand() 532 | myBis() 533 | leftHand2() 534 | def allEyebrows(): 535 | myEyebrow(-8,300) 536 | right(90) 537 | myEyebrow(72,300) 538 | myEyelid(-9,270) 539 | left(15) 540 | myEyelid(68,265) 541 | def allEyes(): 542 | myallEyes1(17,275) 543 | myallEyes2(95,270) 544 | hulk() 545 | allLegs() 546 | myShirt() 547 | myHead() 548 | allHands() 549 | myMouth() 550 | allEyebrows() 551 | allEyes() 552 | myRobot() 553 | ht() 554 | done() 555 | 556 | setposition(300,300) 557 | pencolor("black") 558 | 559 | write("Code by Sumalya Chatterjee") -------------------------------------------------------------------------------- /pikachu.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | 4 | def gajurel(x, y): 5 | turtle.setx(x) 6 | turtle.sety(y) 7 | print(x, y) 8 | 9 | 10 | class Code_BY_Sumalya: 11 | 12 | def __init__(self): 13 | self.t = turtle.Turtle() 14 | t = self.t 15 | t.pensize(3) 16 | t.speed(9) 17 | t.ondrag(gajurel) 18 | 19 | def meme(self, x, y): 20 | self.t.penup() 21 | self.t.goto(x, y) 22 | self.t.pendown() 23 | 24 | def aankha1(self, x, y): 25 | self.meme(x, y) 26 | t = self.t 27 | t.seth(0) 28 | t.fillcolor('#333333') 29 | t.begin_fill() 30 | t.circle(22) 31 | t.end_fill() 32 | 33 | self.meme(x, y + 10) 34 | t.fillcolor('#000000') 35 | t.begin_fill() 36 | t.circle(10) 37 | t.end_fill() 38 | 39 | self.meme(x + 6, y + 22) 40 | t.fillcolor('#ffffff') 41 | t.begin_fill() 42 | t.circle(10) 43 | t.end_fill() 44 | 45 | def aankha2(self, x, y): 46 | self.meme(x, y) 47 | t = self.t 48 | t.seth(0) 49 | t.fillcolor('#333333') 50 | t.begin_fill() 51 | t.circle(22) 52 | t.end_fill() 53 | 54 | self.meme(x, y + 10) 55 | t.fillcolor('#000000') 56 | t.begin_fill() 57 | t.circle(10) 58 | t.end_fill() 59 | 60 | self.meme(x - 6, y + 22) 61 | t.fillcolor('#ffffff') 62 | t.begin_fill() 63 | t.circle(10) 64 | t.end_fill() 65 | 66 | def mukh(self, x, y): 67 | self.meme(x, y) 68 | t = self.t 69 | 70 | t.fillcolor('#88141D') 71 | t.begin_fill() 72 | # 73 | l1 = [] 74 | l2 = [] 75 | t.seth(190) 76 | a = 0.7 77 | for i in range(28): 78 | a += 0.1 79 | t.right(3) 80 | t.fd(a) 81 | l1.append(t.position()) 82 | 83 | self.meme(x, y) 84 | 85 | t.seth(10) 86 | a = 0.7 87 | for i in range(28): 88 | a += 0.1 89 | t.left(3) 90 | t.fd(a) 91 | l2.append(t.position()) 92 | 93 | # 94 | 95 | t.seth(10) 96 | t.circle(50, 15) 97 | t.left(180) 98 | t.circle(-50, 15) 99 | 100 | t.circle(-50, 40) 101 | t.seth(233) 102 | t.circle(-50, 55) 103 | t.left(180) 104 | t.circle(50, 12.1) 105 | t.end_fill() 106 | 107 | # 108 | self.meme(17, 54) 109 | t.fillcolor('#DD716F') 110 | t.begin_fill() 111 | t.seth(145) 112 | t.circle(40, 86) 113 | t.penup() 114 | for pos in reversed(l1[:20]): 115 | t.goto(pos[0], pos[1] + 1.5) 116 | for pos in l2[:20]: 117 | t.goto(pos[0], pos[1] + 1.5) 118 | t.pendown() 119 | t.end_fill() 120 | 121 | # 122 | self.meme(-17, 94) 123 | t.seth(8) 124 | t.fd(4) 125 | t.back(8) 126 | 127 | # 128 | def gaala1(self, x, y): 129 | turtle.tracer(False) 130 | t = self.t 131 | self.meme(x, y) 132 | t.seth(300) 133 | t.fillcolor('#DD4D28') 134 | t.begin_fill() 135 | a = 2.3 136 | for i in range(120): 137 | if 0 <= i < 30 or 60 <= i < 90: 138 | a -= 0.05 139 | t.lt(3) 140 | t.fd(a) 141 | else: 142 | a += 0.05 143 | t.lt(3) 144 | t.fd(a) 145 | t.end_fill() 146 | turtle.tracer(True) 147 | 148 | def gaala2(self, x, y): 149 | t = self.t 150 | turtle.tracer(False) 151 | self.meme(x, y) 152 | t.seth(60) 153 | t.fillcolor('#DD4D28') 154 | t.begin_fill() 155 | a = 2.3 156 | for i in range(120): 157 | if 0 <= i < 30 or 60 <= i < 90: 158 | a -= 0.05 159 | t.lt(3) 160 | t.fd(a) 161 | else: 162 | a += 0.05 163 | t.lt(3) 164 | t.fd(a) 165 | t.end_fill() 166 | turtle.tracer(True) 167 | 168 | def kaan1(self, x, y): 169 | t = self.t 170 | self.meme(x, y) 171 | t.fillcolor('#000000') 172 | t.begin_fill() 173 | t.seth(330) 174 | t.circle(100, 35) 175 | t.seth(219) 176 | t.circle(-300, 19) 177 | t.seth(110) 178 | t.circle(-30, 50) 179 | t.circle(-300, 10) 180 | t.end_fill() 181 | 182 | def kaan2(self, x, y): 183 | t = self.t 184 | self.meme(x, y) 185 | t.fillcolor('#000000') 186 | t.begin_fill() 187 | t.seth(300) 188 | t.circle(-100, 30) 189 | t.seth(35) 190 | t.circle(300, 15) 191 | t.circle(30, 50) 192 | t.seth(190) 193 | t.circle(300, 17) 194 | t.end_fill() 195 | 196 | def jiu(self): 197 | t = self.t 198 | 199 | t.fillcolor('#F6D02F') 200 | t.begin_fill() 201 | # 202 | t.penup() 203 | t.circle(130, 40) 204 | t.pendown() 205 | t.circle(100, 105) 206 | t.left(180) 207 | t.circle(-100, 5) 208 | 209 | # 210 | t.seth(20) 211 | t.circle(300, 30) 212 | t.circle(30, 50) 213 | t.seth(190) 214 | t.circle(300, 36) 215 | 216 | # 217 | t.seth(150) 218 | t.circle(150, 70) 219 | 220 | # 221 | t.seth(200) 222 | t.circle(300, 40) 223 | t.circle(30, 50) 224 | t.seth(20) 225 | t.circle(300, 35) 226 | # print(t.pos()) 227 | 228 | # 229 | t.seth(240) 230 | t.circle(105, 95) 231 | t.left(180) 232 | t.circle(-105, 5) 233 | 234 | # 235 | t.seth(210) 236 | t.circle(500, 18) 237 | t.seth(200) 238 | t.fd(10) 239 | t.seth(280) 240 | t.fd(7) 241 | t.seth(210) 242 | t.fd(10) 243 | t.seth(300) 244 | t.circle(10, 80) 245 | t.seth(220) 246 | t.fd(10) 247 | t.seth(300) 248 | t.circle(10, 80) 249 | t.seth(240) 250 | t.fd(12) 251 | t.seth(0) 252 | t.fd(13) 253 | t.seth(240) 254 | t.circle(10, 70) 255 | t.seth(10) 256 | t.circle(10, 70) 257 | t.seth(10) 258 | t.circle(300, 18) 259 | 260 | t.seth(75) 261 | t.circle(500, 8) 262 | t.left(180) 263 | t.circle(-500, 15) 264 | t.seth(250) 265 | t.circle(100, 65) 266 | 267 | # 268 | t.seth(320) 269 | t.circle(100, 5) 270 | t.left(180) 271 | t.circle(-100, 5) 272 | t.seth(220) 273 | t.circle(200, 20) 274 | t.circle(20, 70) 275 | 276 | t.seth(60) 277 | t.circle(-100, 20) 278 | t.left(180) 279 | t.circle(100, 20) 280 | t.seth(300) 281 | t.circle(10, 70) 282 | 283 | t.seth(60) 284 | t.circle(-100, 20) 285 | t.left(180) 286 | t.circle(100, 20) 287 | t.seth(10) 288 | t.circle(100, 60) 289 | 290 | # 291 | t.seth(180) 292 | t.circle(-100, 10) 293 | t.left(180) 294 | t.circle(100, 10) 295 | t.seth(5) 296 | t.circle(100, 10) 297 | t.circle(-100, 40) 298 | t.circle(100, 35) 299 | t.left(180) 300 | t.circle(-100, 10) 301 | 302 | # 303 | t.seth(290) 304 | t.circle(100, 55) 305 | t.circle(10, 50) 306 | 307 | t.seth(120) 308 | t.circle(100, 20) 309 | t.left(180) 310 | t.circle(-100, 20) 311 | 312 | t.seth(0) 313 | t.circle(10, 50) 314 | 315 | t.seth(110) 316 | t.circle(100, 20) 317 | t.left(180) 318 | t.circle(-100, 20) 319 | 320 | t.seth(30) 321 | t.circle(20, 50) 322 | 323 | t.seth(100) 324 | t.circle(100, 40) 325 | 326 | # 327 | t.seth(200) 328 | t.circle(-100, 5) 329 | t.left(180) 330 | t.circle(100, 5) 331 | t.left(30) 332 | t.circle(100, 75) 333 | t.right(15) 334 | t.circle(-300, 21) 335 | t.left(180) 336 | t.circle(300, 3) 337 | 338 | # 339 | t.seth(43) 340 | t.circle(200, 60) 341 | 342 | t.right(10) 343 | t.fd(10) 344 | 345 | t.circle(5, 160) 346 | t.seth(90) 347 | t.circle(5, 160) 348 | t.seth(90) 349 | 350 | t.fd(10) 351 | t.seth(90) 352 | t.circle(5, 180) 353 | t.fd(10) 354 | 355 | t.left(180) 356 | t.left(20) 357 | t.fd(10) 358 | t.circle(5, 170) 359 | t.fd(10) 360 | t.seth(240) 361 | t.circle(50, 30) 362 | 363 | t.end_fill() 364 | self.meme(130, 125) 365 | t.seth(-20) 366 | t.fd(5) 367 | t.circle(-5, 160) 368 | t.fd(5) 369 | 370 | # 371 | self.meme(166, 130) 372 | t.seth(-90) 373 | t.fd(3) 374 | t.circle(-4, 180) 375 | t.fd(3) 376 | t.seth(-90) 377 | t.fd(3) 378 | t.circle(-4, 180) 379 | t.fd(3) 380 | 381 | # 382 | self.meme(168, 134) 383 | t.fillcolor('#F6D02F') 384 | t.begin_fill() 385 | t.seth(40) 386 | t.fd(200) 387 | t.seth(-80) 388 | t.fd(150) 389 | t.seth(210) 390 | t.fd(150) 391 | t.left(90) 392 | t.fd(100) 393 | t.right(95) 394 | t.fd(100) 395 | t.left(110) 396 | t.fd(70) 397 | t.right(110) 398 | t.fd(80) 399 | t.left(110) 400 | t.fd(30) 401 | t.right(110) 402 | t.fd(32) 403 | 404 | t.right(106) 405 | t.circle(100, 25) 406 | t.right(15) 407 | t.circle(-300, 2) 408 | ############## 409 | # print(t.pos()) 410 | t.seth(30) 411 | t.fd(40) 412 | t.left(100) 413 | t.fd(70) 414 | t.right(100) 415 | t.fd(80) 416 | t.left(100) 417 | t.fd(46) 418 | t.seth(66) 419 | t.circle(200, 38) 420 | t.right(10) 421 | t.fd(10) 422 | t.end_fill() 423 | 424 | # 425 | t.fillcolor('#923E24') 426 | self.meme(126.82, -156.84) 427 | t.begin_fill() 428 | 429 | t.seth(30) 430 | t.fd(40) 431 | t.left(100) 432 | t.fd(40) 433 | t.pencolor('#923e24') 434 | t.seth(-30) 435 | t.fd(30) 436 | t.left(140) 437 | t.fd(20) 438 | t.right(150) 439 | t.fd(20) 440 | t.left(150) 441 | t.fd(20) 442 | t.right(150) 443 | t.fd(20) 444 | t.left(130) 445 | t.fd(18) 446 | t.pencolor('#000000') 447 | t.seth(-45) 448 | t.fd(67) 449 | t.right(110) 450 | t.fd(80) 451 | t.left(110) 452 | t.fd(30) 453 | t.right(110) 454 | t.fd(32) 455 | t.right(106) 456 | t.circle(100, 25) 457 | t.right(15) 458 | t.circle(-300, 2) 459 | t.end_fill() 460 | 461 | self.topi(-134.07, 147.81) 462 | self.mukh(-5, 25) 463 | self.gaala1(-126, 32) 464 | self.gaala2(107, 63) 465 | self.kaan1(-250, 100) 466 | self.kaan2(140, 270) 467 | self.aankha1(-85, 90) 468 | self.aankha2(50, 110) 469 | t.hideturtle() 470 | 471 | def topi(self, x, y): 472 | self.meme(x, y) 473 | t = self.t 474 | t.fillcolor('#CD0000') 475 | t.begin_fill() 476 | t.seth(200) 477 | t.circle(400, 7) 478 | t.left(180) 479 | t.circle(-400, 30) 480 | t.circle(30, 60) 481 | t.fd(50) 482 | t.circle(30, 45) 483 | t.fd(60) 484 | t.left(5) 485 | t.circle(30, 70) 486 | t.right(20) 487 | t.circle(200, 70) 488 | t.circle(30, 60) 489 | t.fd(70) 490 | # print(t.pos()) 491 | t.right(35) 492 | t.fd(50) 493 | t.circle(8, 100) 494 | t.end_fill() 495 | self.meme(-168.47, 185.52) 496 | t.seth(36) 497 | t.circle(-270, 54) 498 | t.left(180) 499 | t.circle(270, 27) 500 | t.circle(-80, 98) 501 | 502 | t.fillcolor('#444444') 503 | t.begin_fill() 504 | t.left(180) 505 | t.circle(80, 197) 506 | t.left(58) 507 | t.circle(200, 45) 508 | t.end_fill() 509 | 510 | self.meme(-58, 270) 511 | t.pencolor('#228B22') 512 | t.dot(35) 513 | 514 | self.meme(-30, 280) 515 | t.fillcolor('#228B22') 516 | t.begin_fill() 517 | t.seth(100) 518 | t.circle(30, 180) 519 | t.seth(190) 520 | t.fd(15) 521 | t.seth(100) 522 | t.circle(-45, 180) 523 | t.right(90) 524 | t.fd(15) 525 | t.end_fill() 526 | t.pencolor('#000000') 527 | 528 | def start(self): 529 | self.jiu() 530 | 531 | 532 | def main(): 533 | print('Painting the Cartoon... ') 534 | turtle.screensize(800, 600) 535 | turtle.title('Code BY Sumalya') 536 | cartoon = Code_BY_Sumalya() 537 | cartoon.start() 538 | turtle.mainloop() 539 | 540 | 541 | 542 | if __name__ == '__main__': 543 | main() --------------------------------------------------------------------------------