运行python程序turtle画图,cmd的方式,画完成之后图形窗口会自动关闭。同样的程序在 IDEL中不会
done()使保from turtle import *
color('red', 'yellow')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) break
end_fill()
done()
怎样在python里让海龟画图抬笔落笔?
用penup() 和 pendown()方法
Python, turtle海龟作图,如何添加背景图片?
turtle.bgpic(r'res/bg.png') #设置。def bgpic(self, picname=None):
"""Set background image or return name of current backgroundimage.
Optional argument:
picname -- a string, name of a gif-file or "nopic".
If picname is a filename, set the corresponding image as background.
If picname is "nopic", delete backgroundimage, if present.
If picname is None, return the filename of the current backgroundimage.
Example (for a Tur