编程语言
首页 > 编程语言> > python蟒蛇绘制思路

python蟒蛇绘制思路

作者:互联网

python蟒蛇绘制思路

图像工具讲解

请添加图片描述

圆的思路讲解

1、调试思路去学习
2、画圆,调试半径,调试角度,调试方向
3、程序一运行,立马退出来(time.sleep())
4、圆的半径,正直:箭头的方向在圆心点的右侧;负值:箭头的方向在圆心点的左侧

测试圆的代码

import turtle
import time
turtle.pensize(25)
turtle.pencolor(“red”)
turtle.seth(-40)
for i in range(4):
turtle.circle(40,80)
time.sleep(2)
turtle.circle(-40,80)
time.sleep(2)

在这里插入图片描述

测试圆的方向代码(seth(-40))

import turtle
import time
turtle.pensize(25)
turtle.pencolor(“red”)
turtle.seth(-40)
for i in range(4):
turtle.circle(40,80)
time.sleep(2)
turtle.circle(-40,80)
time.sleep(2)

画个横坐标和纵坐标

import turtle
import time
turtle.fd(400)
time.sleep(5)
turtle.fd(-200)
time.sleep(5)
turtle.seth(90)
time.sleep(5)
turtle.fd(200)
time.sleep(5)
turtle.fd(-400)
time.sleep(5)
turtle.fd(200)
time.sleep(5)
turtle.seth(0)
time.sleep(5)
turtle.seth(-30)
time.sleep(5)
turtle.fd(100)
time.sleep(5)

测试left和right方向,画个数字8

import turtle
import time
turtle.fd(100)
time.sleep(5)
turtle.left(90)
time.sleep(5)
turtle.fd(100)
time.sleep(5)
turtle.left(90)
time.sleep(5)
turtle.fd(100)
time.sleep(5)
turtle.left(90)
time.sleep(5)
turtle.fd(100)
time.sleep(5)
turtle.fd(-200)
time.sleep(5)
turtle.right(180)
time.sleep(5)
turtle.right(90)
time.sleep(5)
turtle.fd(100)
time.sleep(5)
turtle.right(90)
time.sleep(5)
turtle.fd(100)
time.sleep(5)

画一条蟒蛇

import turtle
import time
turtle.setup(650,350,200,200)
turtle.penup()
turtle.fd(-250)
turtle.pendown()
turtle.pensize(25)
turtle.pencolor(“blue”)
turtle.seth(-40)
for i in range(4):
turtle.circle(40,80)
time.sleep(2)
turtle.circle(-40,80)
time.sleep(2)
turtle.circle(40,40)
turtle.fd(40)
time.sleep(5)
turtle.circle(16,180)
turtle.fd(40*2/3)
time.sleep(30)

标签:turtle,python,import,40,蟒蛇,sleep,time,fd,绘制
来源: https://blog.csdn.net/qq_40168905/article/details/121100811