Python 您所在的位置:网站首页 python绘画酷炫图片 Python

Python

2023-09-25 00:01| 来源: 网络整理| 查看: 265

🥬🥬🥬欢迎来到本博客😊😊😊 本次博客内容将分享几个超级炫酷的Python代码和前端。 📝目前更新:🌟🌟🌟炫酷炫酷代码 💛💛💛本文目录💛💛💛

目录

1 炫酷彩虹

2 温柔的狮子 

3 旋转无尽的真心

4 520+爱心

5 鲜艳的玫瑰

6 一颗小爱心

7 一个呆萌的皮卡丘

8 小猪佩奇

9 放烟花

10 小呆呆小黄人

11 十里桃花飘落

12 炸死小坏蛋

13 哆啦A梦

14 一个微信表情包

15 秀死他

    

1 炫酷彩虹

视频是动态的,不信你运行试试。

from turtle import * colors = ["red", "yellow", "blue", "lime"] bgcolor("black") x = 6 t = [Turtle(), Turtle()] for index, i in enumerate(t): i.speed(0) i.color("white") i.shape("circle") i.shapesize(0.3) i.width(3) i.pu() i.seth(90) i.fd(350) i.seth(-180) i.pd() t[0].pu() delay(0) speed(0) ht() for i in colors: color(i) for i in range(360): t[0].fd(x) t[0].lt(1) pu() goto(t[0].pos()) pd() t[1].fd(2 * x) t[1].lt(2) goto(t[1].pos()) done() 2 温柔的狮子 

import turtle as t def hair(): # 画头发 t.penup() t.goto(-50, 150) t.pendown() t.fillcolor('#a2774d') t.begin_fill() for j in range(10): # 重复执行10次 t.setheading(60 - (j * 36)) # 每次调整初始角度 t.circle(-50, 120) # 画120度的弧 t.end_fill() def face(): # 画脸 t.penup() t.goto(0, 100) t.pendown() t.fillcolor('#f2ae20') t.begin_fill() t.setheading(180) t.circle(85) t.end_fill() # 下巴 t.circle(85, 120) t.fillcolor('white') t.begin_fill() t.circle(85, 120) t.setheading(135) t.circle(100, 95) t.end_fill() def ears(dir): # 画眼睛,dir用来设置方向,左右眼对称 t.penup() t.goto((0 - dir) * 30, 90) t.setheading(90) t.pendown() t.fillcolor('#f2ae20') t.begin_fill() t.circle(dir * 30) t.end_fill() t.penup() t.goto((0 - dir) * 40, 85) t.setheading(90) t.pendown() t.fillcolor('white') t.begin_fill() t.circle(dir * 17) t.end_fill() def nose(): # 画鼻子 t.penup() t.goto(20, 0) t.setheading(90) t.pendown() t.fillcolor('#a2774d') t.begin_fill() t.circle(20) t.end_fill() def eye(dir): # 画耳朵,dir用来设置方向,左右耳对称 t.penup() t.goto((0 - dir) * 30, 20) t.setheading(0) t.pendown() t.fillcolor('black') t.begin_fill() t.circle(10) t.end_fill() def mouth(): # 画嘴巴 t.penup() t.goto(0, 0) t.setheading(-90) t.pendown() t.forward(50) t.setheading(0) t.circle(80, 30) t.penup() t.goto(0, -50) t.setheading(180) t.pendown() t.circle(-80, 30) hair() ears(1) ears(-1) face() eye(1) eye(-1) mouth() nose() t.done()

3 旋转无尽的真心

from turtle import * from colorsys import * def curve(): for i in range(200): right(1) forward(1) tracer(10) delay(0) speed(0) pensize(3) bgcolor("black") left(140) cycles_number=2 for _ in range(cycles_number): s=1 for i in range(36): color("#C90055",hsv_to_rgb(0.92,s,1)) begin_fill() forward(111.65) curve() left(120) curve() forward(111.65) end_fill() hideturtle() right(90) s-=0.02 done() 4 520+爱心

原生JS制作爱心表白代码 - 站长素材 520快乐  5 鲜艳的玫瑰

import turtle import time t = turtle.Turtle() t.speed(1) # 设置初始位置 t.penup() t.left(90) t.fd(200) t.pendown() t.right(90) # 花蕊 t.fillcolor("red") t.begin_fill() t.circle(10, 180) t.circle(25, 110) t.left(50) t.circle(60, 45) t.circle(20, 170) t.right(24) t.fd(30) t.left(10) t.circle(30, 110) t.fd(20) t.left(40) t.circle(90, 70) t.circle(30, 150) t.right(30) t.fd(15) t.circle(80, 90) t.left(15) t.fd(45) t.right(165) t.fd(20) t.left(155) t.circle(150, 80) t.left(50) t.circle(150, 90) t.end_fill() # 花瓣1 t.left(150) t.circle(-90, 70) t.left(20) t.circle(75, 105) t.setheading(60) t.circle(80, 98) t.circle(-90, 40) # 花瓣2 t.left(180) t.circle(90, 40) t.circle(-80, 98) t.setheading(-83) # 叶子1 t.fd(30) t.left(90) t.fd(25) t.left(45) t.fillcolor("green") t.begin_fill() t.circle(-80, 90) t.right(90) t.circle(-80, 90) t.end_fill() t.right(135) t.fd(60) t.left(180) t.fd(85) t.left(90) t.fd(80) # 叶子2 t.right(90) t.right(45) t.fillcolor("green") t.begin_fill() t.circle(80, 90) t.left(90) t.circle(80, 90) t.end_fill() t.left(135) t.fd(60) t.left(180) t.fd(60) t.right(90) t.circle(200, 60) time.sleep(5) 6 一颗小爱心

from turtle import * def curvemove(): for i in range(200): right(1) forward(1) setup(600,600,600,600) hideturtle() pencolor('black') fillcolor("red") pensize(2) begin_fill() left(140) forward(111.65) curvemove() left(120) curvemove() forward(111.65) end_fill() penup() goto(-27, 85) pendown() done()  7 一个呆萌的皮卡丘

# coding:utf-8 import turtle as t import time # 皮卡丘 # 基础设置 t.screensize(800, 600) t.pensize(2) # 设置画笔的大小 t.speed(10) # 设置画笔速度为10 # 画左偏曲线函数 def radian_left(ang, dis, step, n): for i in range(n): dis += step # dis增大step t.lt(ang) # 向左转ang度 t.fd(dis) # 向前走dis的步长 def radian_right(ang, dis, step, n): for i in range(n): dis += step t.rt(ang) # 向左转ang度 t.fd(dis) # 向前走dis的步长 # 画耳朵 def InitEars(): t.color("black", "yellow") # 左耳朵曲线 t.pu() # 提笔 t.goto(-50, 100) # 笔头初始位置 t.pd() # 下笔 t.setheading(110) # 画笔角度 t.begin_fill() radian_left(1.2, 0.4, 0.1, 40) t.setheading(270) # 画笔角度 radian_left(1.2, 0.4, 0.1, 40) t.setheading(44) # 画笔角度 t.forward(32) t.end_fill() # 右耳朵曲线 t.pu() # 提笔 t.goto(50, 100) # 笔头初始位置 t.pd() # 下笔 t.setheading(70) # 画笔角度 t.begin_fill() radian_right(1.2, 0.4, 0.1, 40) t.setheading(270) # 画笔角度 radian_right(1.2, 0.4, 0.1, 40) t.setheading(136) # 画笔角度 t.forward(32) t.end_fill() # 耳朵黑 t.begin_fill() t.fillcolor("black") t.pu() # 提笔 t.goto(88, 141) # 笔头初始位置 t.pd() # 下笔 t.setheading(35) # 画笔角度 radian_right(1.2, 1.6, 0.1, 16) t.setheading(270) # 画笔角度 radian_right(1.2, 0.4, 0.1, 25) t.setheading(132) # 画笔角度 t.forward(31) t.end_fill() t.begin_fill() t.fillcolor("black") t.pu() # 提笔 t.goto(-88, 141) # 笔头初始位置 t.pd() # 下笔 t.setheading(145) # 画笔角度 radian_left(1.2, 1.6, 0.1, 16) t.setheading(270) # 画笔角度 radian_left(1.2, 0.4, 0.1, 25) t.setheading(48) # 画笔角度 t.forward(31) t.end_fill() # 画尾巴 def InitTail(): # 尾巴 t.begin_fill() t.fillcolor("yellow") t.pu() # 提笔 t.goto(64, -140) # 笔头初始位置 t.pd() # 下笔 t.setheading(10) # 画笔角度 t.forward(20) t.setheading(90) # 画笔角度 t.forward(20) t.setheading(10) # 画笔角度 t.forward(10) t.setheading(80) # 画笔角度 t.forward(100) t.setheading(35) # 画笔角度 t.forward(80) t.setheading(260) # 画笔角度 t.forward(100) t.setheading(205) # 画笔角度 t.forward(40) t.setheading(260) # 画笔角度 t.forward(37) t.setheading(205) # 画笔角度 t.forward(20) t.setheading(260) # 画笔角度 t.forward(25) t.setheading(175) # 画笔角度 t.forward(30) t.setheading(100) # 画笔角度 t.forward(13) t.end_fill() # 画脚 def InitFoots(): # 脚 t.begin_fill() t.fillcolor("yellow") t.pensize(2) t.pu() # 提笔 t.goto(-70, -200) # 笔头初始位置 t.pd() # 下笔 t.setheading(225) # 画笔角度 radian_left(0.5, 1.2, 0, 12) radian_left(35, 0.6, 0, 4) radian_left(1, 1.2, 0, 18) t.setheading(160) # 画笔角度 t.forward(13) t.end_fill() t.begin_fill() t.fillcolor("yellow") t.pensize(2) t.pu() # 提笔 t.goto(70, -200) # 笔头初始位置 t.pd() # 下笔 t.setheading(315) # 画笔角度 radian_right(0.5, 1.2, 0, 12) radian_right(35, 0.6, 0, 4) radian_right(1, 1.2, 0, 18) t.setheading(20) # 画笔角度 t.forward(13) t.end_fill() # 画身体 def InitBody(): # 外形轮廓 t.begin_fill() t.pu() # 提笔 t.goto(112, 0) # 笔头初始位置 t.pd() # 下笔 t.setheading(90) # 画笔角度 t.circle(112, 180) t.setheading(250) # 画笔角度 radian_left(1.6, 1.3, 0, 50) radian_left(0.8, 1.5, 0, 25) t.setheading(255) # 画笔角度 radian_left(0.4, 1.6, 0.2, 27) radian_left(2.8, 1, 0, 45) radian_right(0.9, 1.4, 0, 31) t.setheading(355) # 画笔角度 radian_right(0.9, 1.4, 0, 31) radian_left(2.8, 1, 0, 45) radian_left(0.4, 7.2, -0.2, 27) t.setheading(10) # 画笔角度 radian_left(0.8, 1.5, 0, 25) radian_left(1.6, 1.3, 0, 50) t.end_fill() def InitEyes(): # 左眼睛 t.begin_fill() t.fillcolor("black") t.pu() # 提笔 t.goto(-46, 10) # 笔头初始位置 t.pd() # 下笔 t.setheading(90) # 画笔角度 t.circle(5, 360) t.end_fill() # 右眼睛 t.begin_fill() t.fillcolor("black") t.pu() # 提笔 t.goto(46, 10) # 笔头初始位置 t.pd() # 下笔 t.setheading(-90) # 画笔角度 t.circle(5, 360) t.end_fill() # 画脸 def InitFace(): # 脸蛋 t.begin_fill() t.fillcolor("red") t.pu() # 提笔 t.goto(-63, -10) # 笔头初始位置 t.pd() # 下笔 t.setheading(90) # 画笔角度 t.circle(10, 360) t.end_fill() t.begin_fill() t.fillcolor("red") t.pu() # 提笔 t.goto(63, -10) # 笔头初始位置 t.pd() # 下笔 t.setheading(-90) # 画笔角度 t.circle(10, 360) t.end_fill() # 嘴巴 t.pensize(2.2) t.pu() # 提笔 t.goto(0, 0) # 笔头初始位置 t.pd() # 下笔 t.setheading(235) # 画笔角度 radian_right(5, 0.8, 0, 30) t.pu() # 提笔 t.goto(0, 0) # 笔头初始位置 t.pd() # 下笔 t.setheading(305) # 画笔角度 radian_left(5, 0.8, 0, 30) # 画手 def InitHands(): # 左手 t.pensize(2) t.pu() # 提笔 t.goto(-46, -100) # 笔头初始位置 t.pd() # 下笔 t.setheading(285) # 画笔角度 radian_right(0.4, 1.2, 0, 26) radian_right(5, 0.35, 0, 26) radian_right(0.3, 1.2, 0, 15) # 右手 t.pu() # 提笔 t.goto(46, -100) # 笔头初始位置 t.pd() # 下笔 t.setheading(255) # 画笔角度 radian_left(0.4, 1.2, 0, 26) radian_left(5, 0.35, 0, 26) radian_left(0.3, 1.2, 0, 15) def CloseEyes(): # 左眼睛 t.pu() # 提笔 t.goto(-46, 12) # 笔头初始位置 t.pd() # 下笔 t.setheading(180) # 画笔角度 t.forward(10) # 右眼睛 t.pu() # 提笔 t.goto(46, 12) # 笔头初始位置 t.pd() # 下笔 t.setheading(0) # 画笔角度 t.forward(10) # 初始化 def Init(): InitEars() InitTail() InitFoots() InitBody() InitFace() InitHands() InitEyes() # 眨眼睛 def Upgarde(): InitEars() InitTail() InitFoots() InitBody() InitFace() InitHands() CloseEyes() def Upgarde_Init(): InitEars() InitTail() InitFoots() InitBody() InitFace() InitHands() InitEyes() def main(): Init() t.tracer(False) # 眨眼睛动画 for i in range(30): if i % 2 == 0: t.reset() t.hideturtle() Upgarde() t.update() time.sleep(0.3) else: t.reset() t.hideturtle() Upgarde_Init() t.update() time.sleep(1) main() # 结束画笔 t.done()  8 小猪佩奇

import turtle from turtle import * turtle.title('小猪佩奇') def nose(x,y): """画鼻子""" pensize(5) pencolor((255, 155, 192)) penup() # 将海龟移动到指定的坐标 goto(x,y) pendown() # 设置海龟的方向(0-东、90-北、180-西、270-南) setheading(-30) begin_fill() fillcolor(255, 192, 203) a = 0.4 for i in range(120): if 0

现代这种“探索、征服”的心态,从世界地图的演变可以看得一目了然。早在历史进到现代之前,许多文化就已经有了自己的世界地图。当然,当时并没有人真正知道全世界是什么样子,在亚非大陆上的人对美洲一无所知,美洲文化也不知道亚非大陆上的情形。但碰到不熟悉的地区,地图上不是一笔未提,就是画上了想象出来的怪物和奇景。这些地图上并没有空白的空间,让人觉得全世界就在自己的掌握之中。

在15、16世纪,欧洲人的世界地图开始出现大片空白。从这点可以看出科学心态的发展,以及欧洲帝国主义的动机。地图上的空白可以说是在心理及思想上的一大突破,清楚表明欧洲人愿意承认自己对于一大部分的世界还一无所知。

图1 1459年欧洲人的世界地图。可以看到地图上似乎巨细靡遗,就算是当时欧洲人根

                                  本一无所知的南非地区,都有密密麻麻的信息。

1492年,哥伦布从西班牙出发向西航行,希望能找到一条前往东亚的新航线。哥伦布当时相信的仍然是旧的世界地图,以为全世界在地图上一览无遗。哥伦布从旧地图推算,日本应该位于西班牙以西大约7000公里远。但事实上,从西班牙到东亚的距离要超过两万公里,而且中间还隔着个他不知道的美洲大陆。1492年10月12日大约凌晨2点,哥伦布一行人与这片未知大陆有了第一次接触。皮塔号(Pinta)的瞭望手胡安·罗德里格斯·贝尔梅霍(Juan Rodriguez Berme jo)从桅杆上看到了现在的巴哈马群岛,高呼着:“有陆地!有陆地!”

哥伦布当时相信这个小岛就位于东亚海外,属于“Indies”(印度地方,包含今日印度、中南半岛及东印度群岛等地),所以他把当地人称为“Indians”(这正是美国原住民也被称为“印第安人”的原因)。一直到他过世,哥伦布都不认为自己犯了一个大错。不论是对他还是许多当代的人来说,说他发现了一个完全未知的大陆,这根本难以想象。毕竟千百年来,不管是那些伟大的思想家和学者甚至是不可能犯错的《圣经》,都只知道有欧洲、非洲和亚洲。怎么有可能他们全错了呢?难道《圣经》居然漏了大半个世界,只字未提?这种情况,就好像是说在1969年阿波罗11号要前往月球的途中,居然撞到了另一个从来没人看到的月亮。而正因为哥伦布不愿意接受自己的无知,我们可以说他仍然是个中世纪的人,深信着自己已经知道了全世界,所以就算已经有了如此重大的发现,也无法说服他。

至于第一个成为“现代人”的,其实是意大利水手亚美利哥·韦斯普奇(Amerigo Vespucci),他曾在1499~1504年多次航行前往美洲。而在1502~1504年间,欧洲有两篇描述这些航程的文章发表,一般人们相信就出于韦斯普奇之手。这两篇文章提出,哥伦布发现的小岛旁边应该不是东亚,而是一整个大陆,而且不管是《圣经》、过去的地理学者或是当时的欧洲人,在先前都不知道这块大陆的存在。1507年,地图绘制大师马丁·瓦尔德泽米勒(Martin Waldseemiller)相信了这种说法,出版了新版的世界地图。于是,这片西班牙船队向西航行所碰上的土地,终于首次以一块独立大陆的姿态出现在地图上。既然要画,瓦尔德泽米勒就得给它取个名字,但他误以为发现美洲的人是亚美利哥·韦斯普奇,因此为了向他致敬,这片大陆就被命名为“America”(美洲)。瓦尔德泽米勒的地图洛阳纸贵,其他许多地图绘制师也跟着有样学样,因此“美洲”这个名词就这样广为流传。说来也算是老天有眼,到头来,全球有1/4的陆地、七大洲之中的两洲,名字就是来自一个名不见经传的意大利人,而他唯一做的事就只是有勇气说出“我们不知道”。  

发现美洲,对于科学革命是一大奠基事件。这不但让欧洲人知道实际的观察比过去的传统更重要,而且想征服美洲的欲望也让欧洲人开始求知若渴。他们如果真想控制这片广大的新领地,就一定得收集所有相关地理、气候、植物、动物、语言、文化、历史的庞大数据。在这些时候,不管是基督教《圣经》、过时的地理书籍或是古老的口传知识,都无用武之地。  

从此之后,不只是欧洲地理学家,欧洲几乎所有知识领域的学者都学会了留白这一套,诚实面对自己领域的无知,并试着加以填补。他们开始承认自己的理论还不完美,一定还有什么尚未得知的重要信息。

 图2 1525年的萨尔瓦提世界地图(Salviati World Map)。1459年版的世界地图上画 满了各个大陆、岛屿,而且还有详细的解释,但萨尔瓦提地图则有大片留白。我们可以看到美洲的海岸线一路向下之后,接着就是一片空白。任何人只要有一点点的好奇心,看到这份地图之后一定会问:“在那后面有什么呢?”地图上没有答案。这就像是一份邀请,请读者亲身起航、一探究竟



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有