Python – turtle.done() | 您所在的位置:网站首页 › numinput函数python › Python – turtle.done() |
Python – turtle.done()
turtle模块以面向对象和面向过程的方式提供Turtle图形基元。因为它使用 Tkinter 作为底层图形,它需要安装一个支持 Tk 的 Python 版本。 turtle.done()该函数用于启动事件循环–调用Tkinter的主循环函数。它不需要任何参数。必须是Turtle图形程序中的最后一条语句。如果在IDLE中以-n模式(无子进程)运行脚本,必须不使用该函数–用于交互式使用Turtle图形。 语法: turtle.done() 参数:无 回报:无 下面是上述方法的实现和一些例子。 例子1:在最后。 # import package import turtle # motion turtle.forward(100) turtle.right(90) turtle.forward(100) # stop execution turtle.done()输出 : 例子2 :在任何步骤中停止执行。 # import package import turtle # motion turtle.circle(20) turtle.circle(30) # stop execution turtle.done() # motion turtle.circle(40) turtle.circle(50)输出 : |
CopyRight 2018-2019 实验室设备网 版权所有 |