Tuesday, April 25, 2023

Happy Birthday shikha using python turtle graphics

Happy Birthday Shikha using python turtle graphics 

import turtle as tech_habit

from turtle import *
from random import randint

ankita = tech_habit.Screen()
ankita.bgcolor("black")
tech_habit = tech_habit.Turtle()
tech_habit.width(7)
tech_habit.shape('turtle')
tech_habit.speed(29)

colors = ["orange", "red", "dark blue", "green", "#fc037f", "gold", "ivory", "red", "pink",
"green", "blue", "light green", ]


def draw_ankita(i, x, y):
tech_habit.pencolor("linen")
tech_habit.color(colors[i % 7])
tech_habit.begin_fill()
tech_habit.lt(70)
tech_habit.penup()
tech_habit.goto(x, y)
tech_habit.pendown()
tech_habit.circle(33)
tech_habit.end_fill()


def ballon(x, y):
tech_habit.pensize(1)
for i in range(5):
draw_ankita(i, x, y)


def cake(x, y):
tech_habit.fd(x)
tech_habit.rt(90)
tech_habit.fd(y)
tech_habit.rt(90)
tech_habit.fd(x)
tech_habit.rt(90)
tech_habit.fd(y)


def heart():
for i in range(43):
tech_habit.pencolor(colors[i % 9])
tech_habit.rt(5)
tech_habit.fd(5)
tech_habit.pencolor("red")
tech_habit.fd(150)
tech_habit.penup()
tech_habit.rt(140)
tech_habit.fd(147)
tech_habit.pendown()
for i in range(43):
tech_habit.pencolor(colors[i % 9])
tech_habit.lt(5)
tech_habit.fd(5)
tech_habit.pencolor("red")
tech_habit.lt(7)
tech_habit.fd(151)


def move(x, y):
tech_habit.up()
tech_habit.setposition(0, 0)
tech_habit.setheading(90)
tech_habit.rt(90)
tech_habit.fd(x)
tech_habit.lt(90)
tech_habit.fd(y)
tech_habit.pendown()


def mov(x, y):
tech_habit.up()
tech_habit.setposition(0, 0)
tech_habit.setheading(90)
tech_habit.lt(90)
tech_habit.fd(x)
tech_habit.rt(90)
tech_habit.fd(y)
tech_habit.pendown()


def A(size):
tech_habit.rt(19)
tech_habit.forward(size)
tech_habit.rt(141)
tech_habit.fd(size)
tech_habit.backward(size / 2)
tech_habit.rt(105)
tech_habit.fd(int(size / 3))


def B(size):
tech_habit.forward(size)
tech_habit.rt(90)
for i in range(18):
tech_habit.rt(9)
tech_habit.fd(size // 20)
for i in range(18):
tech_habit.rt(size // 5)
tech_habit.backward(size // 20)



def D(size):
tech_habit.fd(size)
tech_habit.rt(90)
tech_habit.fd(size // 10)
for i in range(13):
tech_habit.rt(13)
tech_habit.fd(size // 8)







def G(size):
tech_habit.pensize(10)
tech_habit.penup()
tech_habit.fd(size // 2)
tech_habit.pendown()
tech_habit.lt(90)
tech_habit.fd(size // 4)
tech_habit.backward(size // 1.5)
tech_habit.lt(90)
for _ in range(size):
tech_habit.rt(4)
tech_habit.fd(4)

def S(size):
tech_habit.rt(90)
for i in range(0,5):
if i<3:
tech_habit.fd(size/2)
tech_habit.lt(90)
if i==2:
tech_habit.rt(90)
else:
tech_habit.right(90)
tech_habit.fd(size/2)

def M(size):
tech_habit.fd(int(size/2))
tech_habit.rt(135)
tech_habit.fd(int(size/3))
tech_habit.lt(90)
tech_habit.fd(int(size/3))
tech_habit.rt(135)
tech_habit.fd(int(size/2))


def H(size):
tech_habit.fd(size)
tech_habit.backward(size // 2)
tech_habit.rt(90)
tech_habit.fd(size // 2)
tech_habit.lt(90)
tech_habit.fd(size // 2)
tech_habit.backward(size)

def I(size):
tech_habit.fd(size)
tech_habit.rt(90)
tech_habit.circle(size//8)

def K(size):
tech_habit.fd(size)
tech_habit.backward(size//2)
tech_habit.rt(60)
tech_habit.fd(size//1.5)
tech_habit.backward(size//2)
tech_habit.rt(80)
tech_habit.fd(size//1.3)


def P(size):
tech_habit.fd(size)
tech_habit.rt(90)
tech_habit.fd(size // 8)
for i in range(8):
tech_habit.rt(20)
tech_habit.fd(size // 9)

def R():
tech_habit.fd(60)
tech_habit.rt(90)
tech_habit.fd(7)
for i in range(15):
tech_habit.rt(12)
tech_habit.fd(3)
tech_habit.lt(120)
tech_habit.fd(40)

def T(size):
tech_habit.fd(size)
tech_habit.rt(90)
tech_habit.fd(size // 2)
tech_habit.backward(size // 2)

def U(size):
tech_habit.rt(90)
for i in range(size // 10):
tech_habit.lt(15)
tech_habit.fd(size // 10)
tech_habit.fd(size // 2)
tech_habit.back(size // 2)

for i in range(size // 10):
tech_habit.rt(13)
tech_habit.back(size // 10)
tech_habit.lt(5)
for i in range(size // 10):
tech_habit.rt(17)
tech_habit.back(size // 10)
tech_habit.back(size // 2)


def Y(size):
tech_habit.fd(size)
tech_habit.left(60)
tech_habit.fd(size // 2)
tech_habit.backward(size // 2)
tech_habit.rt(90)
tech_habit.fd(size // 1.5)


tech_habit.width(5)

ballon(223, -150)
ballon(-233, -150)

mov(20,-130)
tech_habit.width(13)

heart()

#Name section
tech_habit.speed(40)
tech_habit.width(4)
tech_habit.pencolor("#d831de")

tech_habit.width(11)

mov(230,240)
S(60)
mov(170,240)
H(60)
mov(110,240)
I(60)
mov(75,240)
K(60)
mov(20,240)
H(60)
mov(-20,240)
A(60)


#Cake maker section
mov(120,80)
tech_habit.color("#94014b")
tech_habit.begin_fill()
cake(40,160)
tech_habit.end_fill()
mov(110,115)
tech_habit.color("#fa348a")
tech_habit.begin_fill()
cake(40,140)
tech_habit.end_fill()
mov(100,150)
tech_habit.color("#fa78b0")
tech_habit.begin_fill()
cake(40,120)
tech_habit.end_fill()
mov(35,200)
tech_habit.width(11)
tech_habit.pencolor("red")
tech_habit.circle(7)


#candles

tech_habit.pensize(3)
tech_habit.penup()
tech_habit.goto(-100,210)
tech_habit.color("red")
tech_habit.left(180)
tech_habit.pendown()
tech_habit.forward(20)

tech_habit.penup()
tech_habit.goto(-80,210)
tech_habit.color("orange")
tech_habit.pendown()
tech_habit.forward(20)


tech_habit.penup()
tech_habit.goto(-10,210)
tech_habit.color("orange")
tech_habit.pendown()
tech_habit.forward(20)

tech_habit.penup()
tech_habit.goto(20,210)
tech_habit.color("red")
tech_habit.pendown()
tech_habit.forward(20)


# #end Of Cake Section


# #ankitabithday
tech_habit.pencolor("#4ceda2")
tech_habit.width(13)
mov(260,-30)
H(100)
tech_habit.width(7)
mov(190,-30)
A(65)
mov(135,-30)
P(60)
mov(100,-30)
P(60)
mov(52,-30)
Y(60)
mov(28,-30)
B(60)
move(8,-30)
I(60)
move(36,-30)
R()
move(80,-30)
T(100)
move(102,-30)
H(60)
move(150,-30)
tech_habit.pencolor('hotpink')
D(200)
move(160,-30)
A(60)
move(220,-30)
Y(60)

ankita.exitonclick()

Happy Birthday Priya Using Python Turtle Graphics

Happy Birthday Priya Using Python Turtle Graphics.... import  turtle  as  tech_habit from turtle import * from random import randint ankita ...