【python】使用turtle画图并封装成exe(2020新年快乐) |
您所在的位置:网站首页 › 贺卡上画的 › 【python】使用turtle画图并封装成exe(2020新年快乐) |
python使用turtle画图并封装成exe
2019年最后一天,总要搞点有趣(不务正业)的事! 新的一年,预祝各位大佬永无bug,青春永驻,保持浓密秀发~~~ 首先需要安装一个包pyinstaller cmd窗口输入:pip install pyinstaller 使用: pyinstaller -F main.py-D:打包成多个文件 -p:指定python安装包路径 -i:指定图标,我的图标放在同目录下 mian.py:要打包的文件,和图标放在同目录下了 -D与-F一一对应,-F是打包成一个单独的文件。最后一排加上–noconsole,就是无窗口运行。 turtle图形库源于1966年诞生的Logo语言,是入门Python的有趣工具。因其简单便捷的图形化方法、和立即反馈式的绘画效果,成为众多编程入门者的首选。 turtle命令详解参考(https://www.cnblogs.com/chen0307/articles/9645138.html) hpny.py文件使用turtle画图。 代码如下: import turtle as t # t.speed(5) t.pensize(8) t.hideturtle() t.screensize(500, 500, bg='white') # 猫脸 t.fillcolor('#00A1E8') t.begin_fill() t.circle(120) t.end_fill() t.pensize(3) t.fillcolor('white') t.begin_fill() t.circle(100) t.end_fill() t.pu() t.home() t.goto(0, 134) t.pd() t.pensize(4) t.fillcolor("#EA0014") t.begin_fill() t.circle(18) t.end_fill() t.pu() t.goto(7, 155) t.pensize(2) t.color('white', 'white') t.pd() t.begin_fill() t.circle(4) t.end_fill() t.pu() t.goto(-30, 160) t.pensize(4) t.pd() t.color('black', 'white') t.begin_fill() a = 0.4 for i in range(120): if 0 |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |