Skip to main content

Wish Good Night using Python | Python Turtle | Simple Python Project

Wish Good Night using Python|Python Turtle|Simple Python Project| Vast Coding


Here is the Source Code:- 

import turtle

import random


# window setup


win = turtle.Screen()

win.setup(width=800,height=600)

win.bgcolor('black')


colors = ['red','blue','orange','yellow','magenta','purple','peru','ivory','dark orange']


# Turtle objects


moon = turtle.Turtle()

moon.hideturtle()


star = turtle.Turtle()

star.speed(0)

star.hideturtle()


text = turtle.Turtle()

text.speed(6)

text.hideturtle()


# Functions


def draw_moon(pos,color):

x,y = pos


moon.color(color)

moon.begin_fill()

moon.penup()

moon.goto(x,y)

moon.pendown()

moon.circle(50)

moon.end_fill()



def stars(x,y,color,length):

star.color(color)


star.penup()

star.goto(x,y)

star.pendown()


star.begin_fill()

for i in range(5):

star.forward(length)

star.right(144)

star.forward(length)

star.end_fill()


def random_pos():

return random.randint(-390,390), random.randint(-200,290)


def random_length():

return random.randint(5,25)


def write_text(color):

text.color(color)


text.penup()

text.goto(-180,-270)

text.pendown()

style = ('Stencil Std Bold',20,'normal')

text.write('Good Night',font=style,move=True)



# Main program


draw_moon((-300,170),'white')

draw_moon((-278,183),'black')


while True:

color = random.choice(colors)

x ,y = random_pos()

length = random_length()


stars(x,y,color,length)

write_text(color)

# moon.clear()


turtle.done()


Output:-

Output

NOTE:- Please help me to grow my Youtube Channel called "Vast Coding"

Comments

Popular posts from this blog

Draw anyone's Sketch using Python Turtle Graphics in Python Programming

Draw anyone's Sketch using Python Turtle Graphics in Python Programming 👨‍💻🔥 In this post ,I will tell you about How to make Anyone's Sketch in Python using svg file and using these libraries: Turtle,cv2(opencv-python),svgpathtools,svg.path and tqdm. You can install these libraries using pip command. Turtle is pre-installed in mostly all programming softwares. And here are the pip commands to install other libraries : pip install opencv-python pip install svgpathtools pip install svg.path pip install tqdm 𝗦𝘁𝗲𝗽𝘀 𝘁𝗼 𝗺𝗮𝗸𝗲 𝘀𝗸𝗲𝘁𝗰𝗵 :  1)Go to https://svgconvert.com/#/  2)Upload the image and change the threshold value according to the image and download it as a svg file.  3)Save the code and svg file in the same folder.  Source Code : import turtle as tu import cv2 from svgpathtools import svg2paths2 from svg.path import parse_path from tqdm import tqdm class sketch_from_svg: def __init__(self,path,scale=30,x_offset=400,y_offset=400): s...

Robert Downey Jr - Tony Stark - Ironman Sketch using Python Turtle Graphics

Robert Downey Jr Sketch using Python Turtle Graphics 👨‍💻 About Python Turtle Graphics : Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967. Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an import turtle , give it the command turtle. Note: If you are facing any issue to copy the code then copy the full page clicking 'select all',paste it to your notepad and copy the code from there. Here is the source code : import turtle as tu class rdj: def __init__(self): self.mouth = [(374, 382),(368, 382),(359, 382),(347, 379),(339, 381),(334, 384),(323, 380),(315, 380),(293, 385),(321, 387),(339, 387),(345, 386),(357, 385),(374, 383),(-1, -1),(389, 389),(393, 387),(395, 381),(395, 373),(377, 362),(366, 357),(358, 360),(351, 357),(345, 354),(344, 357),(337, 355),(333, 357),(327, 355),(323, 357),(303, 362),(...

Netflix Logo using Python Turtle Programming | Simple Python Project | Vast Coding

Netflix Logo using Python Turtle Programming | Simple Python Project | Vast Coding   Here is the Source Code :- import turtle t = turtle.Turtle() t.speed(10) turtle.bgcolor("white") t.color("white") t.up() t.goto(-80,50) t.down() t.fillcolor("black") t.begin_fill() t.forward(200) t.setheading(270) s = 360 for i in range(9): s = s - 10 t.setheading(s) t.forward(10) t.forward(180) s = 270 for i in range(9): s = s - 10 t.setheading(s) t.forward(10) t.forward(200) s = 180 for i in range(9): s = s - 10 t.setheading(s) t.forward(10) t.forward(180) s = 90 for i in range(9): s = s - 10 t.setheading(s) t.forward(10) t.forward(30) t.end_fill() t.up() t.color("black") t.setheading(270) t.forward(240) t.setheading(0) t.down() t.color("red") t.fillcolor("#E50914") t.begin_fill() t.forward(30) t.setheading(90) t.forward(180) t.setheading(180) t.forward(30) t.setheading(270) t.for...