How to install turtle in python
The turtle library is a very popular function library for drawing images in the Python language. Imagine a little turtle, starting at the origin of a coordinate system with the horizontal axis x and the vertical axis y, (0,0), and it starts at the (0,0) position. The control of a set of function instructions moves in this plane coordinate system, thereby drawing graphics on the path it crawls.
Install turtle (Recommended learning: Python video tutorial)
Python2 installation command:
pip install turtule
Python3 installation command:
pip3 install turtle
Drawing example
Sunflower
import turtle as timport time t.color("red", "yellow") t.speed(10) t.begin_fill()for _ in range(50): t.forward(200) t.left(170) end_fill() time.sleep(1)
Drawing five-pointed star
import turtleimport time turtle.pensize(5) turtle.pencolor("yellow") turtle.fillcolor("red") turtle.begin_fill()for _ in range(5): turtle.forward(200) turtle.right(144) turtle.end_fill() time.sleep(2) turtle.penup() turtle.goto(-150,-120) turtle.color("violet") turtle.write("Done", font=('Arial', 40, 'normal')) time.sleep(1)
For more Python-related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of How to install turtle in python. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

Getting started with Python: Hourglass Graphic Drawing and Input Verification This article will solve the variable definition problem encountered by a Python novice in the hourglass Graphic Drawing Program. Code...

Deeply explore the viewing method of Python functools.partial object in functools.partial using Python...

Choice of Python Cross-platform desktop application development library Many Python developers want to develop desktop applications that can run on both Windows and Linux systems...

When using Python's pandas library, how to copy whole columns between two DataFrames with different structures is a common problem. Suppose we have two Dats...

Many developers rely on PyPI (PythonPackageIndex)...

Data Conversion and Statistics: Efficient Processing of Large Data Sets This article will introduce in detail how to convert a data list containing product information to another containing...

How to handle high resolution images in Python to find white areas? Processing a high-resolution picture of 9000x7000 pixels, how to accurately find two of the picture...
