Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make a star in python turtle

import turtle

t=turtle.Turtle()
for i in range(5):
  t.begin_fill()    
  t.forward(75)
  t.right(144)
t.end_fill()
Comment

python turtle star

#import turtle
import turtle
 
# set screen
Screen = turtle.Turtle()
 
# decide colors
cir= ['red','green','blue','yellow','purple']
 
# decide pensize
turtle.pensize(4)
 
# Draw star pattern
turtle.penup()
turtle.setpos(-90,30)
turtle.pendown()
for i in range(5):
    turtle.pencolor(cir[i])
    turtle.forward(200)
    turtle.right(144)
 
turtle.penup()
turtle.setpos(80,-140)
turtle.pendown()
 
# choose pen color
turtle.pencolor("Black")
turtle.done()
Comment

turtle star python

# import turtle library
import turtle             
polygon = turtle.Turtle()
my_num_sides = 6
my_side_length = 70
my_angle = 360.0 / my_num_sides
for i in range(my_num_sides):
   polygon.forward(my_side_length)           
   polygon.right(my_angle) 
turtle.done()
Comment

Python turtle star

#turtle.home()
turtle.left(90)
turtle.heading()
90.0

#Change angle measurement unit to grad (also known as gon, grade, or gradian and equals 1/100-th of the right angle.)
turtle.degrees(400.0)
turtle.heading()
#100.0
turtle.degrees(360)
turtle.heading()
#90.0
Comment

PREVIOUS NEXT
Code Example
Python :: how to put song in pygame 
Python :: cors flask 
Python :: Error: The file/path provided (flaskr) does not appear to exist. Please verify the path is correct. If app is not on PYTHONPATH, ensure the extension is .py 
Python :: multiprocessing print does not work 
Python :: raku fib 
Python :: python use functions from another file 
Python :: compile python folder 
Python :: how to get last n elements of a list in python 
Python :: tkinter 
Python :: how to merge two pandas dataframes on a column 
Python :: set permissions role discord.py 
Python :: how to save dataframe as csv in python 
Python :: discord.py embed 
Python :: how to extract domain name from url python 
Python :: Python create point from coordinates 
Python :: python web crawler 
Python :: python equals override 
Python :: how to capture cmd output in python 
Python :: flatten list python 
Python :: this figure includes axes that are not compatible with tight_layout, so results might be incorrect 
Python :: python get current date and time 
Python :: how to write variables in python 
Python :: connect snowflake with python 
Python :: log loss python 
Python :: pickle load data 
Python :: how to use random tree in python 
Python :: Adding labels to histogram bars in matplotlib 
Python :: python absolute path 
Python :: tensorflow to numpy 
Python :: create endpoint in python 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =