[Python] Draw a Mickey Mouse with Turtle [Beginner]

What is Turtle?

Python's Turtle module advances the turtle and draws at different angles. You might think it's a little messy, but the details are easy to understand ** (methods are also introduced) **. Reference URL: http://www.ic.daito.ac.jp/~mizutani/python/using_turtle.html

Development environment

The IDE I tried is as follows. ・ Xcode ・ Pycharm ·Terminal

Try Turtle first.

Try Turtle with simple code.

from turtle import *

shape()
done()

Then, the window was displayed as below. スクリーンショット 2016-07-04 18.36.13.png

By default, the arrow is just pointing to the right and nothing is drawn. Let's make it a little turtle-like. Enter 'turtle' in shape ().

from turtle import *

shape('turtle')
done()

The arrow displayed in the window is now Mr. Turtle. It's unique. スクリーンショット 2016-07-04 18.33.57.png

By the way, if you run it in the terminal, you don't need done (). If you forget done () in Xcode or Pycharm, you will think that the screen is displayed and it disappears in an instant. Please try once.

Have the turtle draw a square.

Let's move the turtle.

from turtle import *

shape('turtle')
forward(90)
done()

The turtle has advanced a little. スクリーンショット 2016-07-05 10.48.59.png

Let the turtle draw a square. The idea of cord is to move 90 ° to the left and repeat n distances after moving n distances.

from turtle import *

shape('turtle')
for i in xrange(4):
   forward(90)
   left(90)

done()

スクリーンショット 2016-07-05 10.56.46.png

Draw Mickey Mouse

Now you know what the Turtle module looks like. Then, it is the main subject. I will share the source code for drawing Mickey Mouse, so Please try it in your environment! !!

https://github.com/Cremokoroah/Turtle_MM

There should be an easier way to draw, so I would like to improve it. Thank you very much.

Recommended Posts

[Python] Draw a Mickey Mouse with Turtle [Beginner]
Draw Koch curve with Python Turtle
[Python] Drawing a swirl pattern with turtle
[Python] Draw a directed graph with Dash Cytoscape
Try to draw a life curve with python
[Python] Draw a Qiita tag relationship diagram with NetworkX
[Python] How to draw a line graph with Matplotlib
I tried to draw a route map with Python
Forcibly draw something like a flowchart with Python, matplotlib
[Python] How to draw a scatter plot with Matplotlib
Draw a graph with NetworkX
Draw netCDF file with python
[Python] Theremin interface with mouse
Make a fortune with Python
Draw a heart in Python
Web scraping beginner with python
Create a directory with python
Draw a graph with networkx
Study math with Python: Draw a sympy (scipy) graph with matplotlib
A story about a python beginner stuck with No module named'http.server'
[Python] What is a with statement?
Solve ABC163 A ~ C with Python
Operate a receipt printer with python
A python graphing manual with Matplotlib.
Play with a turtle with turtle graphics (Part 1)
Draw a graph with Julia + PyQtGraph (2)
Solve ABC166 A ~ D with Python
Draw a scatterplot matrix in python
Create a virtual environment with Python!
I made a fortune with Python.
Draw a beautiful circle with numpy
Draw a graph with Julia + PyQtGraph (1)
Let's play with Excel with Python [Beginner]
Building a virtual environment with Python 3
Draw a graph with Julia + PyQtGraph (3)
Solve ABC168 A ~ C with Python
Make a recommender system with python
[Beginner] Extract character strings with Python
[Python] Generate a password with Slackbot
Solve ABC162 A ~ C with Python
Draw a graph with pandas + XlsxWriter
Solve ABC167 A ~ C with Python
Solve ABC158 A ~ C with Python
Let's make a graph with python! !!
Draw an illustration with Python + OpenCV
Draw a CNN diagram in Python
Draw Lyapunov Fractal with Python, matplotlib
Draw a graph with PySimple GUI
[Python] Inherit a class with class variables
I made a daemon with Python
[Python] Chapter 03-01 turtle graphics (creating a turtle)
Easily draw a map with matplotlib.basemap
Write a batch script with Python3.5 ~
Draw arrows (vectors) with opencv / python
Draw a watercolor illusion with edge detection in Python3 and openCV3
Spiral book in Python! Python with a spiral book! (Chapter 14 ~)
A note where a Python beginner got stuck
Create a Python function decorator with Class
Creating a simple PowerPoint file with Python
[Python] A program that creates stairs with #
Building a Python3 environment with Amazon Linux2