码迷,mamicode.com
首页 > 编程语言 > 详细

Python: Turtle

时间:2020-03-07 09:57:18      阅读:101      评论:0      收藏:0      [点我收藏+]

标签:ext   you   ids   backward   forward   import   mic   put   src   

Ax_Introduction

Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967.
refer:
https://www.jianshu.com/p/b502c89132dd
https://docs.python.org/3/library/turtle.html

Bx_Note

setx()
sety()
seth()/setheading()
goto(x,y)
circle(r,e)
dot(r,color)
forward()
backward()
pendown()
penup()
left()
right()
...

Cx_Instance

No.1,wjx

from turtle import *
setup(400,400)
penup()
goto(-100,50)
pendown()
color("red")
begin_fill()
for i in range(5):
    forward(200)
    right(144)
end_fill()
hideturtle()
done()

技术图片
No.2,love

from turtle import *
color('red','pink')
begin_fill()
left(135)
fd(100)
right(180)
circle(50,-180)
left(90)
circle(50,-180)
right(180)
fd(100)
end_fill()
hideturtle()
done()

技术图片
No.3,lx

import turtle
n = 10
for i in range(1,10,1):
    for j in [90,180,-90,0]:
        turtle.seth(j)
        turtle.fd(n)
        n += 5

技术图片

No.4,textinput

>>> turtle.textinput("NIM","What is your name?")

技术图片

Dx_Hit the pit

技术图片

by En0moThem

Python: Turtle

标签:ext   you   ids   backward   forward   import   mic   put   src   

原文地址:https://www.cnblogs.com/enomothem/p/12432255.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!