猫史档案馆


【Python作品分享】妙笔生花-预置代码

用户:茂盛成长茂盛成长查看:0 回复:0 评论:0 创建时间:2021-05-21T15:14:15


【作品展示】

center_image

 

【作品介绍】

gyk

 

【作品源代码】

# 导入库
import pgzrun
import random

# 空列表
balls = []

# 鼠标移动模块
def on_mouse_move(pos, rel, buttons):
    # 当鼠标左键按下时
# 画图模块
    if mouse.LEFT in buttons:
        # 设置圆的位置、大小和颜色
        pos = (pos[0], pos[1])  # 设置位置
        radius = 6              # 设置半径大小
        color = (0, 0, 0)       # 设置颜色
        # 保存所有圆的信息
        ball = [pos, radius, color]
        balls.append(ball)

def draw():   
    # 设置背景为白色
    screen.fill("white")  
    # 画出所有圆
    for ball in balls:
        pos = ball[0]      # 位置
        radius = ball[1]   # 半径大小
        color = ball[2]    # 颜色
        screen.draw.filled_circle(ImportError)  # 画圆点 

# 开始执行指令
pgzrun.go() 

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页