turtle fillcolor_用Python的turtle作画(1)——花树

写在前面

经常在知乎和博客上看到使用Python(大多是turtle库)绘制的图形,进行实际操作,可行的与大家分享。

一、注意事项

注意:使用pycharm进行绘图,可能会有pycharm不能识别turtle问题?

解决方法:

1.找到turtle.py(pycharm中查找文件的快捷键是ctrl+shift+N);

对 turtle.py的源码进行如下修改(每个turtle.py文件都要修改):

2.注释掉原来的_all_

  • __all__ = ['ScrolledCanvas', 'TurtleScreen', 'Screen', 'RawTurtle', 'Turtle', 'RawPen', 'Pen', 'Shape', 'Vec2D', 'back', 'backward', 'begin_fill', 'begin_poly', 'bk', 'addshape', 'bgcolor', 'bgpic', 'bye', 'clearscreen', 'colormode', 'delay', 'exitonclick', 'getcanvas', 'getshapes', 'listen', 'mainloop', 'mode', 'numinput','onkey', 'onkeypress', 'onkeyrelease', 'onscreenclick', 'ontimer', 'register_shape', 'resetscreen', 'screensize', 'setup', 'Terminator', 'setworldcoordinates', 'textinput', 'title', 'tracer', 'turtles','update', 'window_height', 'window_width', 'write_docstringdict', 'done', 'circle', 'clear', 'clearstamp', 'clearstamps', 'clone', 'color', 'degrees', 'distance', 'dot', 'down', 'end_fill', 'end_poly', 'fd','fillcolor', 'filling', 'forward', 'get_poly', 'getpen', 'getscreen', 'get_shapepoly', 'getturtle', 'goto','heading', 'hideturtle', 'home', 'ht', 'isdown', 'isvisible', 'left', 'lt', 'onclick', 'ondrag', 'onrelease','pd', 'pen', 'pencolor', 'pendown', 'pensize', 'penup', 'pos', 'position', 'pu', 'radians', 'right', 'reset', 'resizemode', 'rt', 'seth', 'setheading', 'setpos', 'setposition', 'settiltangle', 'setundobuffer', 'setx','sety', 'shape', 'shapesize', 'shapetransform', 'shearfactor', 'showturtle', 'speed', 'st', 'stamp', 'tilt','tiltangle', 'towards', 'turtlesize', 'undo', 'undobufferentries', 'up', 'width', 'write', 'xcor', 'ycor']

1d245c38a8207a6a82c550f85fbf3882.png

5af33ddd327b827dffadb0b65e5b582a.png

二、上图

1、玫瑰花

from 

f8ae6bc4cf046d5c1eaee2481ff84a71.png

2、动态樱花

import 

3f006b2e9dd814bb19960881b62b5974.png

3、有飘落效果的樱花

from 

7a6b79fd4a94d4469a0cf2c3e3e21a64.png

4、暗色效果樱花

from 

44d5f27402dc2b249ae61fbdbcb85627.png

5、动态生成圣诞树

from 

9b4f08a058a1d953ce95e2c062cc424a.png

参考:博客园

持续更新中......

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值