本文介绍了即使用笔,如何阻止乌龟画画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 python 中使用了turtle模块.问题是,每当我让乌龟移动时,即使笔在上面,我也会画画.例如,如果我运行这个程序:
I am using the turtle module in python. the problem is that whenever I have the turtle move i will draw even if the pen is up. for example if I run this program:
import turtle
turtle.penup
turtle.goto(0,50)
海龟移动到 (0,50) 时仍然会画一条线为什么会这样,如何预防?
the turtle will still draw a line when it moves to (0,50)why is this and how can it be prevented?
推荐答案
看起来您实际上并没有调用turtle.penup.试试这个:
It looks like you're not actually calling turtle.penup. Try this:
import turtle
turtle.penup()
turtle.goto(0,50)
这篇关于即使用笔,如何阻止乌龟画画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!