问一个问题,这是关于编程画图问题,我没学,但要交练习
,比较麻烦,以后学,先解决眼前问题,前面都是废话,凑字数的,看题
import turtle
# 画布大小和坐标轴范围
size = 500
min_val = -10
max_val = 10
# 设置turtle画笔的初始位置和方向
turtle.penup()
turtle.setx(-200)
turtle.sety(-200)
turtle.pendown()
turtle.setheading(0)
# 设置turtle画笔的初始位置和方向
turtle.penup()
turtle.goto(-size/2, 0)
turtle.pendown()
turtle.goto(size/2, 0)
turtle.penup()
turtle.goto(0, -size/2)
turtle.pendown()
turtle.goto(0, size/2)
# 标注坐标轴原点O
turtle.penup()
turtle.setx(10)
turtle.sety(10)
turtle.write("O", font=("Arial", 14, "italic"))
# 绘制直线
turtle.penup()
turtle.goto(-100, -70)
turtle.pendown()
turtle.goto(70, 130)
turtle.penup()
turtle.goto(90, 150)
turtle.write("y=1.5x+30", font=("Arial", 14, "normal"))
# 关闭turtle画板
turtle.done()