turtle画开机流程图

使用turtle画开机(计算机监控系统自动开水轮发电机组)流程图,本人菜鸟一枚,以下的过程比较繁琐,请高手多多指教。

导入及画笔设置

import turtle as t
import math

t.pensize(2)
t.colormode(255)
t.color((0,0,0),'black')
t.speed(20)
t.setup(0.6,1.0)
t.screensize(1000,1700)

标题

t.penup()
t.goto(0,800)
t.write('开机操作流程图', font=('黑体',30,), align="center")

准备框

t.penup()
t.goto(0,700)
t.pendown()
t.forward(75)
t.circle(25,180)
t.forward(150)
t.circle(25,180)
t.forward(75)

t.penup()
t.setheading(-90)
t.forward(-10)
t.write('开始操作', font=('宋体',20,), align="center")

连接线

t.forward(10)
t.pendown()
t.forward(60)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(-90)
t.forward(10)

流程框

t.right(90)
t.forward(100)
t.left(90)
t.forward(50)
t.left(90)
t.forward(200)
t.left(90)
t.forward(50)
t.left(90)
t.forward(100)
t.penup()
t.setheading(-90)
t.forward(40)
t.write('操作投入', font=('宋体',20,), align="center")

连接线

t.forward(10)
t.pendown()
t.forward(60)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(-90)
t.forward(10)

流程框

t.right(90)
t.forward(100)
t.left(90)
t.forward(50)
t.left(90)
t.forward(200)
t.left(90)
t.forward(50)
t.left(90)
t.forward(100)
t.penup()
t.setheading(-90)
t.forward(40)
t.write('监视控制图', font=('宋体',20,), align="center")

连接线

t.forward(10)
t.pendown()
t.forward(60)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(-90)
t.forward(10)

流程框

t.right(90)
t.forward(100)
t.left(90)
t.forward(50)
t.left(90)
t.forward(200)
t.left(90)
t.forward(50)
t.left(90)
t.forward(100)
t.penup()
t.setheading(-90)
t.forward(40)
t.write('点击#1机图标', font=('宋体',20,), align="center")

连接线

t.forward(10)
t.pendown()
t.forward(60)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(-90)
t.forward(10)

流程框

t.right(90)
t.forward(100)
t.left(90)
t.forward(50)
t.left(90)
t.forward(200)
t.left(90)
t.forward(50)
t.left(90)
t.forward(100)
t.penup()
t.setheading(-90)
t.forward(40)
t.write('弹出电站背景', font=('宋体',20,), align="center")

连接线

t.forward(10)
t.pendown()
t.forward(60)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(-90)
t.forward(10)

判断框

t.right(60)
t.forward(100)
t.left(120)
t.forward(100)
t.left(60)
t.forward(100)
t.left(120)
t.forward(100)
t.penup()
t.setheading(-90)
t.forward(70)
t.write('确认电站', font=('宋体',20,), align="center")

连接线

t.forward(30)
t.pendown()
t.forward(60)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(-90)
t.forward(10)

判断框

t.right(60)
t.forward(100)
t.left(120)
t.forward(100)
t.left(60)
t.forward(100)
t.left(120)
t.forward(100)
t.penup()
t.setheading(-90)
t.forward(70)
t.write('确认机组', font=('宋体',20,), align="center")

连接线

t.forward(30)
t.pendown()
t.forward(60)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(-90)
t.forward(10)

判断框

t.right(60)
t.forward(100)
t.left(120)
t.forward(100)
t.left(60)
t.forward(100)
t.left(120)
t.forward(100)
t.penup()
t.setheading(-90)
t.forward(70)
t.write('确认操作方式', font=('宋体',20,), align="center")

连接线

t.forward(30)
t.pendown()
t.forward(60)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(-90)
t.forward(10)

流程框

t.right(90)
t.forward(100)
t.left(90)
t.forward(50)
t.left(90)
t.forward(200)
t.left(90)
t.forward(50)
t.left(90)
t.forward(100)
t.penup()
t.setheading(-90)
t.forward(40)
t.write('输入设备码', font=('宋体',20,), align="center")

连接线

t.forward(10)
t.pendown()
t.forward(60)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(-90)
t.forward(10)

判断框

t.right(60)
t.forward(100)
t.left(120)
t.forward(100)
t.left(60)
t.forward(100)
t.left(120)
t.forward(100)
t.penup()
t.setheading(-90)
t.forward(70)
t.write('确认开机', font=('宋体',20,), align="center")

连接线

t.forward(30)
t.pendown()
t.forward(60)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(-90)
t.forward(10)

流程框

t.right(90)
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(200)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)

t.forward(80)
t.left(90)
t.forward(100)
t.left(90)
t.forward(160)
t.left(90)
t.forward(100)
t.left(90)
t.forward(80)

t.penup()
t.setheading(-90)
t.forward(80)
t.write('启动自动开\n#1机流程', font=('宋体',20,), align="center")

否认1

t.penup()
t.setheading(90)
t.forward(780)
t.right(90)
t.forward(50 * math.sqrt(3))
t.pendown()
t.forward(50)
t.left(90)
t.forward(175)
t.write('否', font=('宋体',20,), align="left")
t.forward(175)
t.left(90)
t.forward(50 + 50 * math.sqrt(3)-100)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(180)
t.forward(10)

否认2

t.penup()
t.forward(100 + 50 * math.sqrt(3))
t.left(90)
t.forward(510)
t.right(90)
t.pendown()
t.forward(50)
t.right(90)
t.forward(260)
t.write('否', font=('宋体',20,), align="right")
t.forward(250)
t.right(90)
t.forward(50 + 50 * math.sqrt(3)-100)

连接线的箭头

t.forward(-10)
t.begin_fill()
t.fillcolor('black')
t.right(90)
t.forward(10 * math.tan(math.pi/12))
t.left(105)
t.forward(10 / math.cos(math.pi/12))
t.left(150)
t.forward(10 / math.cos(math.pi/12))
t.left(105)
t.forward(10 * math.tan(math.pi/12))
t.end_fill()
t.setheading(0)
t.forward(10)

否认3

t.penup()
t.forward(100 + 50 * math.sqrt(3))
t.right(90)
t.forward(670)
t.left(90)
t.pendown()
t.forward(100)
t.left(90)
t.forward(340)
t.write('否', font=('宋体',20,), align="left")
t.forward(330)
t.left(90)
t.forward(100 + 50 * math.sqrt(3)-100)

否认4

t.penup()
t.forward(100 + 50 * math.sqrt(3))
t.left(90)
t.forward(940)
t.right(90)
t.pendown()
t.forward(100)
t.right(90)
t.forward(500)
t.write('否', font=('宋体',20,), align="right")
t.forward(440)
t.right(90)
t.forward(100 + 50 * math.sqrt(3)-100)

t.hideturtle()

img = t.getscreen()
img.getcanvas().postscript(file="chart.eps")   #保存图片

t.done()

效果图如下:

简单的开机流程图

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值