用Python做一个爱心泡泡机。
代码如下:
- import turtle
- import random
- import math
- # 初始化
- turtle.setup(1280, 720)
- t = turtle.Pen()
- t.ht()
- # 颜色
- colors = []
- t_list = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]
- for i in t_list:
- t_str = "#ff00"
- for j in t_list:
- colors.append(t_str+i+j)
- class Love():
- def __init__(self):