How To Draw A Hawaiian Turtle
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Turtle programming in Python
Turtle is a special feathers of Python. Using Turtle, nosotros tin hands depict in a cartoon board.
First nosotros import the turtle module. And then create a window, next we create turtle object and using turtle method we can describe in the cartoon lath.
Some turtle method
METHOD | PARAMETER | DESCRIPTION |
---|---|---|
Turtle() | None | It creates and returns a new turtle object |
forrad() | corporeality | It moves the turtle forrard by the specified corporeality |
astern() | amount | It moves the turtle backward by the specified corporeality |
right() | angle | Information technology turns the turtle clockwise |
left() | angle | It turns the turtle counter clockwise |
penup() | None | Information technology picks upwardly the turtle's Pen |
pendown() | None | Puts downward the turtle's Pen |
upwards() | None | Picks up the turtle'southward Pen |
down() | None | Puts downward the turtle'southward Pen |
color() | Colour name | Changes the colour of the turtle's pen |
fillcolor() | Color proper name | Changes the color of the turtle will apply to fill a polygon |
heading() | None | It returns the electric current heading |
position() | None | It returns the current position |
goto() | x, y | It moves the turtle to position x,y |
begin_fill() | None | Remember the starting betoken for a filled polygon |
end_fill() | None | Information technology closes the polygon and fills with the current fill color |
dot() | None | Leaves the dot at the current position |
stamp() | None | Leaves an impression of a turtle shape at the electric current location |
shape() | shapename | Should be 'arrow', 'classic', 'turtle' or 'circle' |
Example code
# import turtle library import turtle my_window = turtle.Screen() my_window.bgcolor("blue") # creates a graphics window my_pen = turtle.Turtle() my_pen.forward(150) my_pen.left(90) my_pen.forward(75) my_pen.color("white") my_pen.pensize(12)
Output
Draw a Foursquare
Example code
# import turtle library import turtle my_pen = turtle.Turtle() for i in range(4): my_pen.forward(50) my_pen.right(xc) turtle.washed()
Output
Draw a star
Example code
# import turtle library import turtle my_pen = turtle.Turtle() for i in range(50): my_pen.forward(50) my_pen.right(144) turtle.done()
Output
Draw a Hexagon
Example code
# 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()
Output
Draw a square inside another foursquare box.
Example code
# import turtle library import turtle my_wn = turtle.Screen() my_wn.bgcolor("light blue") my_wn.title("Turtle") my_pen = turtle.Turtle() my_pen.colour("black") def my_sqrfunc(size): for i in range(4): my_pen.fd(size) my_pen.left(ninety) size = size - 5 my_sqrfunc(146) my_sqrfunc(126) my_sqrfunc(106) my_sqrfunc(86) my_sqrfunc(66) my_sqrfunc(46) my_sqrfunc(26)
Output
Drawing of another pattern
Case code
# import turtle library import turtle my_wn = turtle.Screen() turtle.speed(2) for i in range(30): turtle.circle(5*i) turtle.circumvolve(-5*i) turtle.left(i) turtle.exitonclick()
Output
Drawing of another pattern
Example code
# import turtle library import turtle colors = [ "cherry-red","purple","blue","green","orange","yellow"] my_pen = turtle.Pen() turtle.bgcolor("black") for 10 in range(360): my_pen.pencolor(colors[x % six]) my_pen.width(10/100 + 1) my_pen.forward(x) my_pen.left(59)
Output
Published on 08-Nov-2018 xi:12:28
- Related Questions & Answers
- Turtle graphics using Python
- How to draw unlike shapes using the Python Turtle library?
- Socket programming In Python
- Tkinter Programming in Python
- Object Oriented Programming in Python?
- Hangman Game in Python Programming
- Basic Python Programming Challenges
- History of Python Programming
- Meta programming with Metaclasses in Python
- List of Keywords in Python Programming
- Command Line Interface Programming in Python?
- How to practice CGI programming in Python?
- Socket Programming with Multi-threading in Python?
- Working with csv files in Python Programming
- Binary Tree Postorder Traversal in Python Programming
Source: https://www.tutorialspoint.com/turtle-programming-in-python
Posted by: lenoxnembee.blogspot.com
0 Response to "How To Draw A Hawaiian Turtle"
Post a Comment