解决Pycharm调用Turtle时 窗口一闪而过的问题

yipeiwu_com7年前Python基础

如下所示:

#彩色螺旋线
import turtle
turtle.pensize(2)
turtle.bgcolor("black")
colors = ["red","yellow","purple","blue"]
turtle.tracer(False)
for x in range(400):
 turtle.forward(2*x)
 turtle.color(colors[x % 4])
 turtle.left(91)
turtle.tracer(True)

在用pycharm调用Turtle画图时,上面的代码显示一闪而过

最后加上一句turtle.done()即可解决

#彩色螺旋线
import turtle
turtle.pensize(2)
turtle.bgcolor("black")
colors = ["red","yellow","purple","blue"]
turtle.tracer(False)
for x in range(400):
 turtle.forward(2*x)
 turtle.color(colors[x % 4])
 turtle.left(91)
turtle.tracer(True)
turtle.done()

效果如下:

Pycharm调用Turtle时 窗口一闪而过

以上这篇解决Pycharm调用Turtle时 窗口一闪而过的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

对python mayavi三维绘图的实现详解

对python mayavi三维绘图的实现详解

网上下载mayavi的官方帮助文档,里面有很多例子,下面的记录都是查看手册后得到的。 http://code.enthought.com/projects/mayavi/docs/dev...

python3实现字符串操作的实例代码

python3字符串操作 x = 'abc' y = 'defgh' print(x + y) #x+y print(x * 3) #x*n print(x...

详解Python中的__new__()方法的使用

先看下object类中对__new__()方法的定义: class object: @staticmethod # known case of __new__...

Python利用ORM控制MongoDB(MongoEngine)的步骤全纪录

简介: MongoEngine 是一个Document-Object Mapper (想一下ORM, 但它是针对文档型数据库),Python通过它与MongoDB交互。你可能会说那PyM...

python 系统调用的实例详解

python 系统调用的实例详解             &nbs...