如下图小猪佩奇: 要求使用turtle画小猪佩奇: 源码: # encoding=utf-8 # -*- coding: UTF-8 -*- # 使用turtle画小猪佩奇 from turtle import* def nose(x,y):#鼻子 penup()#提起笔 goto(x,y)#定位 pendown()#落笔,开始画 setheading(-30)#将乌龟的方向设置为to_angle/为数字(0-东.90-北.180-西.270-南) begin_fill()#准备开始填充图形 a…
from turtle import * def nose(x,y):#鼻子 penup()#提起笔 goto(x,y)#定位 pendown()#落笔,开始画 setheading(-30)#将乌龟的方向设置为to_angle/为数字(0-东.90-北.180-西.270-南) begin_fill()#准备开始填充图形 a=0.4 for i in range(120): if 0<=i<30 or 60<=i<90: a=a+0.08 left(3) #向左转3度 forwa…
Python之turtle库-小猪佩奇 #!/usr/bin/env python # coding: utf-8 # Python turtle库官方文档:https://docs.python.org/2/library/turtle.html import turtle as t t.begin_fill() t.pensize(4) t.hideturtle() t.colormode(255) t.color((255, 155, 192), "pink") t.setup(…
转自:python画个小猪佩奇 # -*- coding: utf-8 -*- """ Created on Mon May 20 11:36:03 2019 @author: epsoft """ import turtle as t def nose(x,y):#鼻子 t.pu() t.goto(x,y) t.pd() t.seth(-30) t.begin_fill() a=0.4 for i in range(120): if 0<…
略作改动: # coding:utf-8 import turtle as t t.screensize(400, 300, "blue") t.pensize(4) # 设置画笔的大小 t.colormode(255) # 设置GBK颜色范围为0-255 t.color((255,155,192),"pink") # 设置画笔颜色和填充颜色(pink) t.setup(840,500) # 设置主窗口的大小为840*500 t.speed(10) # 设置画笔速度…
import turtle as t t.pensize(4) t.hideturtle() t.colormode(255) t.color((255,155,192),"pink") t.setup(840,500) t.speed(10) #鼻子 t.pu() t.goto(-100,100) t.pd() t.seth(-30) t.begin_fill() a=0.4 for i in range(120): if 0<=i<30 or 60<=i<9…
Turtle库 简介 什么是Turtle 首先,turtle库是一个点线面的简单图像库,能够完成一些比较简单的几何图像可视化.它就像一个小乌龟,在一个横轴为x.纵轴为y的坐标系原点,(0,0)位置开始,它根据一组函数指令的控制,在这个平面坐标系中移动,从而在它爬行的路径上绘制了图形. Turtle库基础知识 1.画布(canvas) 画布就是turtle为我们展开用于绘图区域默认大小(400, 300),我们可以设置它的大小和初始位置. 2.画笔(pen) 2.1画笔的状态在画布上,默认有一个坐…
原题: 使用turtle画五角星: 我的代码: #!/usr/bin/python # encoding=utf-8 # -*- coding: UTF-8 -*- from turtle import Turtle p = Turtle() # p.speed(3) #画笔速度 p.pensize(5) #画笔粗细 p.color("black",'yellow') #画笔颜色/背景颜色 #p.fillcolor("red") #北京颜色 p.begin_fill…
利用Python编写简单网络爬虫实例3 by:授客 QQ:1033553122 实验环境 python版本:3.3.5(2.7下报错 实验目的 获取目标网站“http://bbs.51testing.com/forum.php”中特定url,通过分析发现,目标url同其它url的关系如下   目标url存在子页面中的文章中,随机分布,我们要把它找出来 python脚本 #!/usr/bin/env python # -*- coding:utf-8 -*- from urllib.request…
利用Python编写简单网络爬虫实例2 by:授客 QQ:1033553122 实验环境 python版本:3.3.5(2.7下报错 实验目的 获取目标网站“http://www.51testing.com/html/index.html”中特定url,通过分析发现,目标url同其它url的关系如下   目标url存在子页面中的文章中,随机分布,我们要把它找出来 python脚本 #!/usr/bin/env python # -*- coding:utf-8 -*- from urllib.r…