python蟒蛇绘制思路
2021/11/2 17:12:47
本文主要是介绍python蟒蛇绘制思路,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
python蟒蛇绘制思路
- 图像工具讲解
- 圆的思路讲解
- 测试圆的代码
- 测试圆的方向代码(seth(-40))
- 画个横坐标和纵坐标
- 测试left和right方向,画个数字8
- 画一条蟒蛇
图像工具讲解
圆的思路讲解
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)
这篇关于python蟒蛇绘制思路的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2025-01-03用FastAPI掌握Python异步IO:轻松实现高并发网络请求处理
- 2025-01-02封装学习:Python面向对象编程基础教程
- 2024-12-28Python编程基础教程
- 2024-12-27Python编程入门指南
- 2024-12-27Python编程基础
- 2024-12-27Python编程基础教程
- 2024-12-27Python编程基础指南
- 2024-12-24Python编程入门指南
- 2024-12-24Python编程基础入门
- 2024-12-24Python编程基础:变量与数据类型