当前位置:
首页 > 编程开发 > Python基础教程 >
-
python基础教程之分享给大家几段有趣的代码,学会python画画可以不用自己动手啦
本站最新发布 Python从入门到精通|Python基础教程
试听地址 https://www.xin3721.com/eschool/pythonxin3721/
试听地址 https://www.xin3721.com/eschool/pythonxin3721/
前言
Python 是一门简单易学且功能强大的编程语言,无需繁琐的配置,掌握基本语法,了解基本库函数,就可以通过调用海量的现有工具包编写自己的程序,轻松实现批量自动化操作,可以极大提高办公和学习效率。Python爬虫可以批量获取网页上的数据。
Python几段代码也能让我们做出几个有趣的动画
1、旋转动画
#SquareSpiral1.py
import turtle
t = turtle.Pen()
turtle.bgcolor("black")
sides=6
colors=["red","yellow","green","blue","orange","purple"]
for x in range(360):
t.pencolor(colors[x%sides])
t.forward(x*3/sides+x)
t.left(360/sides+1)
t.width(x*sides/200)
print("####结束####")
2、画纸飞机
import turtle
#太阳
turtle.color('red')
turtle.penup()
turtle.goto(250,200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.color('black','blue')
turtle.begin_fill()
#飞机
turtle.penup()
turtle.home()
turtle.pendown()
turtle.pensize(5)
turtle.goto(-300,150)
turtle.goto(100,50)
turtle.goto(0,0)
turtle.end_fill()
turtle.goto(-30,-125)
turtle.goto(-50,-50)
turtle.begin_fill()
turtle.goto(-300,150)
turtle.goto(-125,-125)
turtle.goto(-50,-50)
turtle.goto(-30,-125)
turtle.goto(-85,-85)
turtle.end_fill()
#线条
turtle.pensize(3)
turtle.penup()
turtle.goto(75,25)
turtle.pendown()
turtle.goto(200,0)
turtle.penup()
turtle.goto(50,-5)
turtle.pendown()
turtle.goto(250,-30)
turtle.penup()
turtle.goto(10,-80)
turtle.pendown()
turtle.goto(100,-150)
turtle.penup()
turtle.goto(-80,-125)
turtle.pendown()
turtle.goto(120,-200)
turtle.ht()
3、画小猪佩奇
4.画哆啦A梦头像
栏目列表
最新更新
如何使用OS模块中的stat方法
Python os 模块
seek() 方法
python打开文件实例1
Python写入文件
什么是流?
文件操作如何进制逐行读取
Python相对路径
with创建临时运行环境
Python文件操作
.Net Standard(.Net Core)实现获取配置信息
Linux PXE + Kickstart 自动装机
Shell 编程 基础
Shell 编程 条件语句
CentOS8-网卡配置及详解
Linux中LVM逻辑卷管理
1.数码相框-相框框架分析(1)
Ubuntu armhf 版本国内源
Linux中raid磁盘阵列
搭建简易网站
access教程之Access简介
mysql 安装了最新版本8.x版本后的报错:
Mysql空间数据&空间索引(spatial)
如何远程连接SQL Server数据库的图文教程
复制SqlServer数据库的方法
搜索sql语句
sql中返回参数的值
sql中生成查询的模糊匹配字符串
数据定义功能
数据操作功能