Zero basic python introductory tutorial: python666.cn
Hello everyone, welcome to Crossin's programming classroom!
Before, I used turtle in Python to draw a few more complicated pictures:
Many students are very interested in this module after reading it. Today, I will share with you an easy-to-understand tutorial to get started with turtle.
The Turtle thing
Turtle (also known as Turtle Drawing) is a drawing library whose drawing principle is to simulate a small turtle crawling on the screen, and its crawling path forms a drawn graph.
Therefore, using Turtle to draw is easy and fun, and it is very suitable for Python introductory learning and Python advanced learning.
▊ Basic Concepts in Turtle
There are two important basic concepts in Turtle.
1 Screen: It is the drawing area of Turtle, we can set the size and background color of the screen, as shown in the following figure. Note that the coordinate origin of the screen is at the center of the screen.
2 Turtle (alias: brush): The brush used for drawing, it is an object created by the Turtle class. Turtles have properties such as color, line width, position, and orientation, as shown in the image below.
▊ Use Turtle to draw a rectangle
The sample code is as follows:
The sample code is as follows:
draw basic graphics
Use Turtle to draw lines, arcs, and text. Of course, all kinds of polygons can be drawn as straight lines can be drawn.
▊Draw a five-pointed star
The sample code is as follows:
▊Draw circles and arcs
Since you can draw arcs with Turtle, you can also draw circles. Let's practice drawing circles and arcs through an example, as shown in the following figure.
The sample code is as follows:
This article is excerpted from "Learn Python 2 by Reading Comics: Interesting, Informative, Fun, and Easy to Use (Full Color Advanced Edition)", more exciting content, welcome to read this book!
▊ " Learn Python 2 by Reading Comics: Interesting, Informative, Fun, and Easy to Use (Full Color Advanced Edition)"
Kanto rises
-
Reading comics to learn Python advanced version
-
Full color, providing courseware, source code, readership and other services
-
Interesting, informative, fun, easy to use, suitable for Python programmers, primary and secondary school students, etc.
-
Summer vacation with a baby weapon!
This book is an advanced version of "Learn Python by Reading Comics". It continues to adhere to the concept of being interesting, informative, fun, and easy to use, and continues to use 3 different comic characters in the book "Learn Python by Reading Comics". Through these 3 Easy conversations between characters simplify complex technical issues .
If you want to improve your Python skills, whether you are a primary school student who wants to learn programming, a middle school student who wants to participate in computer competitions, or a college student majoring in computer related majors, or even a professional person who is engaged in software development, this book is suitable for you to read and learn .
7.30~8.1 JD.com is offering 50% off for a limited time
Scan the code to learn more about this book!
_Past article recommendation_