turtle与pillow生成半透明效果的图形

如本文章标有价格,需议价或其它事情商议请加微信scratch8

李兴球Pythonturtle与pillow生成半透明效果的图形

以下是完全源代码:

"""
   turtle与pillow生成半透明效果的图形
"""
import turtle
from PIL import Image,ImageDraw,ImageTk

def make_circle_image(diameter=200,color=(255,0,0,127)):
    """生成圆形图"""
    im = Image.new("RGBA",(diameter,diameter))
    draw = ImageDraw.Draw(im)
    draw.ellipse((0,0,diameter ,diameter),fill=color)
    return im

redim = make_circle_image()
greenim = make_circle_image(color=(0,127,0,127))
blueim = make_circle_image(color=(0,0,127,127))

turtle.penup()
screen = turtle.getscreen()
screen.setup(480,360)
screen.bgpic('c:/bgsnow.png')
screen.title('turtle与pillow生成半透明效果的图形by李兴球')

redcircle = turtle.Shape('image',ImageTk.PhotoImage(redim)) 
screen.register_shape('redcircle',redcircle)

greencircle = turtle.Shape('image',ImageTk.PhotoImage(greenim)) 
screen.register_shape('greencircle',greencircle)

bluecircle = turtle.Shape('image',ImageTk.PhotoImage(blueim))

screen.register_shape('bluecircle',bluecircle)
turtle.fd(-50)
turtle.shape('redcircle')
turtle.stamp()
turtle.fd(50)
turtle.shape('greencircle')
turtle.stamp()
turtle.fd(50)
turtle.shape('bluecircle')
turtle.stamp()
turtle.ht()



本站所有作品,教程等皆为原创,版权所有。只供个人及单位内部研究使用,对外展示或传播必需经本站同意,且注明来自本站。培训机构等用本站资源培训学生,需经本站授权。一旦付款,表示同意本站知识付费原则:数字商品,不支持退款。亦可直接向微信号scratch8付款购买。入住QQ群:225792826 和爱好者共同交流,并且能下载免费提供的Python资源(需提供真实姓名才可入群)
李兴球的博客_Python创意编程技术前沿_pygame » turtle与pillow生成半透明效果的图形
scratch

学本领,探索更大的世界!

李兴球博客 风火轮编程主页