Python turtle画月饼
2021/9/20 17:32:36
本文主要是介绍Python turtle画月饼,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
import turtle as t def goto(x, y): t.penup() t.goto(x, y) t.pendown() def draw_edges(x, y, color): count = 20 length = 210 t.color(color) goto(x, y) for foo in range(count): t.right(360 / count) t.begin_fill() t.fd(length) t.circle(40, 180) t.end_fill() goto(x, y) def draw_circle(): goto(0, -190) t.pensize(5) t.color(shadow) t.circle(190) def draw_font(): t.color(shadow) size = 80 goto(-size / 2, 80) font = ('kaiti', size, 'bold') t.write('豆', font=font) goto(-size / 2, -80 - size) t.write('沙', font=font) size = 50 content = '海上生明月 天涯共此时' len_ = len(content) + 2 t.color('red') goto(-len_ * size / 2, -400) font = ('kaiti', size, 'bold') t.write(content, font=font) color = 'khaki' shadow = '#d9b300' t.speed(1000) draw_edges(-25, 25, shadow) draw_edges(0, 0, color) draw_circle() write() t.done()
这篇关于Python turtle画月饼的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-08有遇到过吗?同样的规则 Excel 中 比Python 结果大
- 2024-03-30开始python成长之路
- 2024-03-29python optparse
- 2024-03-29python map 函数
- 2024-03-20invalid format specifier python
- 2024-03-18pool.map python
- 2024-03-18threads in python
- 2024-03-14python Ai 应用开发基础训练,字符串,字典,文件
- 2024-03-13id3 algorithm python
- 2024-03-13sum array elements python