Posts

Showing posts from August, 2021

creating rakhi from Turtle module in python apni programming

Image
import math import turtle tina = turtle.Turtle() tina.shape("turtle") tina.color("black") tina.speed(0) def pos(x,y): tina.penup() tina.goto(x,y) tina.pendown() tina.color("red") tina.begin_fill() pos(0,-250) tina.circle(250) tina.end_fill() def draw(t, numseeds, angle, cspread):     t.fillcolor("orange")     phi = angle * (math.pi / 120.0)         for i in range (numseeds):       # figure out the next x, y position       r = cspread * math.sqrt(i)       theta = i * phi       x = r * math.cos(theta)       y = r * math.sin(theta)       # move the turtle and orient it correctly       t.penup()       t.goto(x, y)       t.setheading(i * angle)       if i <  numseeds:         t.stamp()        draw(tina,500,18.7,9)    pos(250,0) tina.pensize(15) tina.pencolor("gold") for i in range(40): tina.left(5) tina.forward(25) pos(-250,0) tina.pensize(15) tina.pencolor("gold") for i in range(40): tina.left(5) tina.forward(25)

creating doremon using turtle python

Image
from turtle import * # Doraemon with Python Turtle def krish(x, y):     penup()     goto(x, y)     pendown() def aankha():     fillcolor("#ffffff")     begin_fill()     tracer(False)     a = 2.5     for i in range(120):         if 0 <= i < 30 or 60 <= i < 90:             a -= 0.05             lt(3)             fd(a)         else:             a += 0.05             lt(3)             fd(a)     tracer(True)     end_fill() def daari():     krish(-32, 135)     seth(165)     fd(60)     krish(-32, 125)     seth(180)     fd(60)     krish(-32, 115)     seth(193)     fd(60)     krish(37, 135)     seth(15)     fd(60)     krish(37, 125)     seth(0)     fd(60)     krish(37, 115)     seth(-13)     fd(60) def mukh():     krish(5, 148)     seth(270)     fd(100)     seth(0)     circle(120, 50)     seth(230)     circle(-120, 100) def muflar():     fillcolor('#e70010')     begin_fill()     seth(0)     fd(200)     circle(-5, 90)     fd(10)     circle(-5, 90)     fd(207)     ci

creating pikachu using turtle python apni programming

Image
#APNI PROGRAMMING #By Krish bhagat import turtle def gajurel(x, y):     turtle.setx(x)     turtle.sety(y)     print(x, y) class Cartoon:     def __init__(self):         self.t = turtle.Turtle()         t = self.t         t.pensize(3)         t.speed(9)         t.ondrag(gajurel)     def meme(self, x, y):         self.t.penup()         self.t.goto(x, y)         self.t.pendown()     def aankha1(self, x, y):         self.meme(x, y)         t = self.t         t.seth(0)         t.fillcolor('#333333')         t.begin_fill()         t.circle(22)         t.end_fill()         self.meme(x, y + 10)         t.fillcolor('#000000')         t.begin_fill()         t.circle(10)         t.end_fill()         self.meme(x + 6, y + 22)         t.fillcolor('#ffffff')         t.begin_fill()         t.circle(10)         t.end_fill()     def aankha2(self, x, y):         self.meme(x, y)         t = self.t         t.seth(0)         t.fillcolor('#333333')         t.begin_fill()      

creating our national flag using turtle python

Image
import turtle from turtle import* wn=turtle.Screen() wn.bgpic("<location of photo in png>")   #screen for output screen = turtle.Screen()   # Defining a turtle Instance t = turtle.Turtle() speed(1)   # initially penup() t.penup() t.goto(-400, 250) t.pendown()   # Orange Rectangle  #white rectangle t.color("orange") t.begin_fill() t.forward(800) t.right(90) t.forward(167) t.right(90) t.forward(800) t.end_fill() t.left(90)   # Green Rectangle t.color("white") t.begin_fill() t.forward(167) t.left(90) t.forward(800) t.left(90) t.forward(167) t.end_fill()   # Big Blue Circle t.penup() t.goto(70, 0) t.pendown() t.color("navy") t.begin_fill() t.circle(70) t.end_fill()   # Big White Circle t.penup() t.goto(60, 0) t.pendown() t.color("white") t.begin_fill() t.circle(60) t.end_fill()   # Mini Blue Circles t.penup() t.goto(-57, -8) t.pendown() t.color("navy") for i in range(24):     t.begin_fill()     t.circle(3)     t.

creating tricolour badge using turtle python apni programming 2021

Image
import turtle trt = turtle.Turtle() scr = turtle.Screen() scr.setup(850,850) scr.bgpic("<location of photo in png> ") scr.bgcolor('black') trt.speed(0) trt.pensize(5) colors = ['orange', 'white', 'green'] radius = 150   for color in colors:         for i in range(6):                  for j in range(6):             trt.color(color)             trt.circle(radius)              trt.left(10)         radius = radius -50   trt.hideturtle()  turtle.done()  

creating trishul from turtle python apni programming 2021

Image
import turtle as t def mypos(x,y): t.penup() t.goto(x,y) t.pendown() t.bgcolor("gold") scr = turtle.Screen() scr.setup(850,850) scr.bgpic("<location of image only png>") t.color("black","grey") t.pensize(5) t.begin_fill() mypos(0,15) t.right(90) t.forward(250) t.right(90) t.forward(20) t.right(90) t.forward(500) t.left(60) t.forward(120) t.right(60) t.forward(150) t.left(62) t.forward(70) t.right(170) t.forward(90) t.right(65) t.forward(140) t.left(60) t.forward(50) t.left(110) t.forward(150) t.right(30) t.forward(50) t.right(120) t.forward(50) t.right(30) t.forward(150) t.left(110) t.forward(50) t.left(65) t.forward(140) t.right(60) t.forward(90) t.right(165) t.forward(70) t.left(50) t.forward(150) t.right(62) t.forward(110) t.left(65) t.forward(252) t.hideturtle() t.end_fill() mypos(-75,200) t.color("black","brown") t.begin_fill() t.left(60) t.forward(150) t.left(120) t.forward(75) t.left(120) t.forward(

creating OM ॐ from turtle python apni programming 2021

Image
import turtle  turtle.bgcolor("black") t1=turtle.Turtle() t1.pensize(0) t1.speed(0) t1.color("white","white") t1.penup() t1.setposition(0,0) t1.pendown() t1.begin_fill() t1.left(20) t1.forward(300) t1.left(90) t1.forward(200) t1.left(60) t1.forward(300) t1.left(45) t1.forward(200) t1.left(165) t1.forward(200) t1.right(30) t1.forward(230) t1.right(55) t1.forward(150) t1.right(87.5) t1.forward(260) t1.left(30) t1.left(90) t1.end_fill() t2=turtle.Turtle() t2.pensize(0) t2.speed(0) t2.color("white","white") t2.penup() t2.setposition(0,0) t2.pendown() t2.begin_fill() t2.right(20) t2.forward(300) t2.right(90) t2.forward(200) t2.right(60) t2.forward(300) t2.right(45) t2.forward(200) t2.right(165) t2.forward(200) t2.left(30) t2.forward(230) t2.left(55) t2.forward(150) t2.left(87.5) t2.forward(260) t2.right(30) t2.right(90) t2.end_fill() t7 = turtle.Turtle() t7.pensize(0) t7.speed(0) t7.color("white", "white") t7.penup() t7.s

creating lord shiva 2 by turtle python apni programming

Image
import turtle as t t.bgcolor("black") t.pencolor("black") t.fillcolor("white") t.penup() t.goto(-150,0) t.pendown() t.begin_fill() t.pensize(5) t.left(90) t.forward(20) t.right(90) t.forward(300) t.right(90) t.forward(20) t.right(90) t.forward(300) t.end_fill() t.penup() t.begin_fill() t.left(90) t.forward(10) t.pendown() t.left(90) t.forward(300) t.right(90) t.forward(20) t.right(90) t.forward(300) t.right(90) t.forward(20) t.end_fill() t.penup() t.begin_fill() t.backward(50) t.pendown() t.forward(20) t.right(90) t.forward(300) t.right(90) t.forward(20) t.right(90) t.forward(300) t.end_fill() t.pencolor("black") t.fillcolor("white") t.penup() t.goto(0,-23) t.left(90) t.forward(70) t.left(270) t.pendown() t.begin_fill() t.right(90) t.left(15) t.forward(50) t.right(15) t.forward(75) t.right(15) t.forward(50) t.left(15) t.right(165) t.forward(50) t.right(15) t.forward(75) t.right(15) t. forward(50)  t.left(15) t.end_fill() t.penup() t.pen

creating spider using turtle python apni programming

Image
import turtle as t t.bgcolor("red") t.begin_fill() t.circle(60) t.end_fill() t.penup() t.goto(4,25) t.pendown() t.begin_fill() t.right(45) t.forward(100) t.right(65) t.forward(150) t.right(135) t.forward(40) t.left(135) t.forward(40) t.right(135) t.forward(150) t.right(65) t.forward(100) t.end_fill() t.begin_fill() t.penup() t.goto(20,85) t.pendown() t.left(30) t.forward(40) t.left(45) t.forward(50) t.left(165) t.forward(50) t.right(30) t.forward(40) t.penup() t.goto(-20,84) t.right(120) t.pendown() t.right(30) t.forward(40) t.right(45) t.forward(50) t.right(165) t.forward(50) t.left(30) t.forward(40) t.penup() t.goto(45,63) t.pendown() t.left(110) t.forward(60) t.right(90) t.forward(140) t.left(150) t.forward(400) t.left(80) t.forward(60) t.right(175) t.forward(70) t.right(85) t.forward(460) t.right(149) t.forward(170) t.left(90) t.forward(100) t.penup() t.goto(45,20) t.left(90) t.pendown() t.left(90) t.forward(50) t.right(90) t.forward(220) t.left(147) t.forward(530) t.left

Creating shivling from turtle python

Image
  import turtle turtle.bgcolor('gold') turtle.speed(0) turtle.setup(800,600)  turtle.speed(9)  turtle.up()   def my_goto(x, y) : turtle.pencolor("orange")  turtle.penup()  turtle.goto(x, y)  turtle.pendown() def round_rectangle(centre_x,centre_y,width,height,cornersize) : turtle.up()  turtle.goto(centre_x-width/2+cornersize,centre_y-height/2)  turtle.down()  for _ in range(2) : turtle.begin_fill() turtle.fd(width-2*cornersize)  turtle.circle(cornersize,90) turtle.fd(height-2*cornersize)  turtle.circle(cornersize,90)  turtle.end_fill() def round_rectangle(centre_x,centre_y,width,height,cornersize) : turtle.up()  turtle.goto(centre_x-width/2+cornersize,centre_y-height/2) turtle.down()  for _ in range(2) : turtle.fillcolor("black")  turtle.begin_fill()  turtle.fd(width-2*cornersize)  turtle.circle(cornersize,90)  turtle.fd(height-2*cornersize)  turtle.circle(cornersize,90)  turtle.end_fill()