用鼠标牵引一个小眼珠移动的源代码。这个小眼珠是画出来的。你可以发挥想像力,把它制作成一个小游戏。以下是代码预览:
"""
牵引小眼珠画笔交互动画。这个程序中的小眼珠是画出来的,
当鼠标移动时,它会朝向鼠标的方向移动。
"""
from turtle import *
..............
def draw_eye(t):
"""画眼珠"""
t.color('white')
t.begin_fill()
t.fd(25)
t.left(90)
t.circle(25)
t.end_fill()
t.right(90)
t.color('black')
........
width,height = 480,360
screen = Screen()
screen.tracer(0,0)
screen.setup(width,height)
screen.bgcolor("dodger blue")
screen.title('牵引小眼珠画笔交互动画by李兴球')
......................
如需要查看所有源代码,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)

