Python中的turtle.up()方法 |
您所在的位置:网站首页 › c语言turtle › Python中的turtle.up()方法 |
Python中的turtle.up()方法
turtle模块以面向对象和面向过程的方式提供Turtle图形基元。因为它使用 Tkinter 作为底层图形,它需要安装一个支持 Tk 的 Python 版本。 turtle.up()turtle.up()方法是用来把笔从屏幕上拉起来的。它在移动到另一个位置或方向时不提供任何绘图。 turtle.up() or turtle.pu() or turtle.penup()在这里,这个方法可以用上面写的三个名字来调用,也就是说,它的别名是:penup | pu | up。这个方法不需要任何参数。 下面是上述方法的实现和一些例子。 例子1 : # import package import turtle # forward the turtle (drawing) turtle.forward(50) # up the turtle turtle.up() # forward the turtle (no drawing) turtle.forward(50) # down the turtle turtle.down() # forward the turtle (drawing) turtle.forward(50)输出: 例子2 : # import package import turtle # forward the turtle (drawing) turtle.forward(50) # turn right 90 degrees turtle.right(90) # up the turtle turtle.up() # forward the turtle (no drawing) turtle.forward(50) # down the turtle turtle.down() # turn right 90 degrees turtle.right(90) # forward the turtle (drawing) turtle.forward(50)输出: |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |