用Python Turtle库画b站logo(张野 付博林组)

视频就在这里

由于不知道很多函数只等自己一点一点的试??
哔哩哔哩 (゜-゜)つロ 干杯~

import turtle
turtle.speed(6)
turtle.screensize(300,300)
turtle.colormode(255)
turtle.color(0,204,255)
turtle.up()
turtle.goto(130,230)
turtle.down()
for _ in range(2):
    turtle.pensize(18)
    turtle.circle(-20,90)
    turtle.pensize(20)
    turtle.fd(190)
    turtle.pensize(18)
    turtle.circle(-20,90)
    turtle.pensize(20)
    turtle.fd(260)
turtle.up()
turtle.goto(20,230)
turtle.left(45)
turtle.down()
turtle.pensize(13)
turtle.fd(75)
turtle.up()
turtle.goto(-20,230)
turtle.left(90)
turtle.down()
turtle.fd(75)
turtle.up()
turtle.goto(65,-8)
turtle.pensize(1)
turtle.down()
turtle.color((0,204,255),(0,204,255))
turtle.begin_fill()
turtle.left(135)
turtle.circle(13,180)
turtle.end_fill()
turtle.up()
turtle.goto(-65,-8)
turtle.down()
turtle.begin_fill()
turtle.circle(13,-180)
turtle.end_fill()
turtle.up()
turtle.goto(0,80)
turtle.down()
turtle.begin_fill()
turtle.right(30)
turtle.circle(-15,120)
turtle.left(90)
turtle.fd(10)
turtle.left(90)
turtle.circle(25,90)
turtle.end_fill()
turtle.begin_fill()
turtle.up()
turtle.goto(0,80)
turtle.down()
turtle.right(-90)
turtle.circle(-15,-120)
turtle.left(90)
turtle.fd(10)
turtle.left(90)
turtle.circle(25,-90)
turtle.end_fill()
turtle.up()
turtle.goto(45,180)
turtle.left(15)
turtle.down()
turtle.begin_fill()
for _ in range(2):
    turtle.fd(70)
    turtle.right(90)
    turtle.fd(22)
    turtle.right(90)
turtle.end_fill()
turtle.right(150)
turtle.up()
turtle.goto(-45,180)
turtle.down()
turtle.begin_fill()
for _ in range(2):
    turtle.fd(70)
    turtle.left(90)
    turtle.fd(22)
    turtle.left(90)
turtle.end_fill()
turtle.up()
#B
turtle.goto(-180,-120)
turtle.left(80)
turtle.down()
turtle.begin_fill()
turtle.fd(90)
turtle.right(5)
turtle.fd(40)
turtle.left(90)
for i in range(10):
    turtle.left(0.5)
    turtle.fd(4)
for i in range(40):
    turtle.left(1)
    turtle.fd(0.5)
for i in range(90):
    turtle.left(1)
    turtle.fd(0.25)
for i in range(40):
    turtle.left(1)
    turtle.fd(0.5)
for i in range(10):
    turtle.left(0.5)
    turtle.fd(3)
turtle.right(92)
turtle.fd(100)
turtle.goto(-180,-120)
turtle.end_fill()
turtle.color((0,204,255),(255,255,255))
turtle.begin_fill()
turtle.up()
turtle.goto(-150,-220)
turtle.left(180)
turtle.down()
for i in range(3):
    turtle.fd(23)
    turtle.left(120)
turtle.end_fill()
#I
turtle.color((0,204,255),(0,204,255))
turtle.up()
turtle.goto(-100,-140)
turtle.left(10)
turtle.color((0,204,255),(0,204,255))
turtle.begin_fill()
turtle.down()
for i in range(2):
    turtle.fd(23)
    turtle.left(90)
    turtle.fd(8)
    turtle.left(90)
turtle.up()
turtle.goto(-90,-140)
turtle.down()
for i in range(2):
    turtle.fd(25)
    turtle.left(90)
    turtle.fd(8)
    turtle.left(90)
turtle.end_fill()
turtle.begin_fill()
turtle.up()
turtle.goto(-95,-180)
turtle.down()
turtle.fd(70)
turtle.left(90)
turtle.fd(10)
turtle.left(85)
turtle.fd(70)
turtle.goto(-95,-180)
turtle.end_fill()
#L
turtle.begin_fill()
turtle.up()
turtle.goto(-70,-110)
turtle.down()
turtle.right(177)
turtle.fd(130)
turtle.left(87)
turtle.fd(8)
turtle.left(90)
turtle.fd(130)
turtle.goto(-70,-110)
turtle.left(180)
turtle.end_fill()
#I
turtle.up()
turtle.goto(-40,-140)
turtle.color((0,204,255),(0,204,255))
turtle.begin_fill()
turtle.down()
for i in range(2):
    turtle.fd(23)
    turtle.left(90)
    turtle.fd(8)
    turtle.left(90)
turtle.up()
turtle.goto(-30,-140)
turtle.down()
for i in range(2):
    turtle.fd(25)
    turtle.left(90)
    turtle.fd(8)
    turtle.left(90)
turtle.end_fill()
turtle.begin_fill()
turtle.up()
turtle.goto(-35,-180)
turtle.down()
turtle.fd(70)
turtle.left(90)
turtle.fd(10)
turtle.left(85)
turtle.fd(70)
turtle.goto(-35,-180)
turtle.end_fill()
turtle.left(107)
turtle.up()
#B
turtle.goto(0,-120)
turtle.left(80)
turtle.down()
turtle.begin_fill()
turtle.fd(90)
turtle.right(5)
turtle.fd(40)
turtle.left(90)
for i in range(10):
    turtle.left(0.5)
    turtle.fd(4)
for i in range(40):
    turtle.left(1)
    turtle.fd(0.5)
for i in range(90):
    turtle.left(1)
    turtle.fd(0.25)
for i in range(40):
    turtle.left(1)
    turtle.fd(0.5)
for i in range(10):
    turtle.left(0.5)
    turtle.fd(3)
turtle.right(92)
turtle.fd(100)
turtle.goto(0,-120)
turtle.end_fill()
turtle.color((0,204,255),(255,255,255))
turtle.begin_fill()
turtle.up()
turtle.goto(30,-220)
turtle.left(180)
turtle.down()
for i in range(3):
    turtle.fd(23)
    turtle.left(120)
turtle.end_fill()
#I
turtle.color((0,204,255),(0,204,255))
turtle.up()
turtle.goto(80,-140)
turtle.left(10)
turtle.color((0,204,255),(0,204,255))
turtle.begin_fill()
turtle.down()
for i in range(2):
    turtle.fd(23)
    turtle.left(90)
    turtle.fd(8)
    turtle.left(90)
turtle.up()
turtle.goto(90,-140)
turtle.down()
for i in range(2):
    turtle.fd(25)
    turtle.left(90)
    turtle.fd(8)
    turtle.left(90)
turtle.end_fill()
turtle.begin_fill()
turtle.up()
turtle.goto(85,-180)
turtle.down()
turtle.fd(70)
turtle.left(90)
turtle.fd(10)
turtle.left(85)
turtle.fd(70)
turtle.goto(85,-180)
turtle.end_fill()
#L
turtle.begin_fill()
turtle.up()
turtle.goto(110,-110)
turtle.down()
turtle.right(177)
turtle.fd(130)
turtle.left(87)
turtle.fd(8)
turtle.left(90)
turtle.fd(130)
turtle.goto(110,-110)
turtle.left(180)
turtle.end_fill()
#I
turtle.up()
turtle.goto(140,-140)
turtle.color((0,204,255),(0,204,255))
turtle.begin_fill()
turtle.down()
for i in range(2):
    turtle.fd(23)
    turtle.left(90)
    turtle.fd(8)
    turtle.left(90)
turtle.up()
turtle.goto(150,-140)
turtle.down()
for i in range(2):
    turtle.fd(25)
    turtle.left(90)
    turtle.fd(8)
    turtle.left(90)
turtle.end_fill()
turtle.begin_fill()
turtle.up()
turtle.goto(145,-180)
turtle.down()
turtle.fd(70)
turtle.left(90)
turtle.fd(10)
turtle.left(85)
turtle.fd(70)
turtle.goto(145,-180)
turtle.end_fill()
turtle.hideturtle()
turtle.mainloop()

原文地址:https://www.cnblogs.com/gentle33/p/9940653.html

时间: 2024-10-04 04:12:14

用Python Turtle库画b站logo(张野 付博林组)的相关文章

原来python还能这么用,使用turtle库画出漂亮的画!

Tuttle库是python内置库,今天就利用它画出各种漂亮的图! 如何画出多重五角星? 效果展示如下:是不是很酷呢,下面还有更酷的玩法.多重五角星的代码比较简单,用到了循环跟turtle库一些简单的方法就实现了. 如何画出一颗漂亮的树呢? 效果展示如下:是不是可以用beatiful来形容,自己一个个敲出来更有成就感,赶紧动手试一下吧!!! 还有更高阶的玩法:加入一些花瓣是不是感觉像自己完成的一幅佳作,以前要用笔画几个小时,现在你只需要几行代码就可以完成一幅漂亮的画: 欢迎点击右上角关注?转发,

Turtle库画小猫咪

视频请点击这里哟 这个是用python库画的小猫咪,前面一步步的画整个猫的整个身体,具体步骤都写在了注释之中.身体部分画的比较快,后面画了5个心,由于画心的时候要改变好多度数,而且每次只前进一点点,所以画心的时候会比较慢,大家在看视频的时候会发现这一点.这个东西花了好个小时画出来,好多地方都是几像素几像素的试出来的.不过,我画画能力一般,加上时间有限,并不能完善所有细节.但是我尽可能多的完善了一些线条和布局,弧度之类的的细节,希望大家喜欢我们的作品. 希望大家多多支持我们的作品哟! #!/usr

Python turtle库的应用——蛇

turtle库介绍 1.Turtle中的turtle.setup()函数用于启动一个图形窗口,它有四个参数 turtle.setup(width, height, startx, starty) 分别是:启动窗口的宽度和高度表示窗口启动时,窗口左上角在屏幕中的坐标位置. 我们所使用的显示屏幕也是一个坐标系,该坐标系以左上角为原点,向左和向下分别是x轴和y轴.蟒蛇程序代码启动一个1300像素宽.800像素高的窗口,该窗口的左上角是屏幕的左上角. (startx,starty)表示画的初始点,(0,

python turtle库的几个小demo

一.先上图 一个同切圆和五角星 上代码 import turtle #同切圆 turtle.pensize(2) turtle.circle(10) turtle.circle(40) turtle.circle(80) turtle.circle(160) #五角星 from turtle import * color('red','yellow') begin_fill() for i in range(5): fd(200) rt(144) end_fill() done() 至于turt

Python turtle库绘制简单图形

一.简介 Python中的turtle库是一个直观有趣的图形绘制函数库.turtle库绘制图形有一个基本框架:一个小海龟在坐标系中爬行,其爬行轨迹形成了绘制图形. 二.简单的图形列举 1.绘制4个不同半径的同切圆 代码: import turtleturtle.pensize(4)turtle.circle(10)turtle.circle(40)turtle.circle(80)turtle.circle(120)turtle.done() 结果: 2.六角形的绘制,利用turtle库绘制一个

[Python] turtle库的基本使用

turtle库常用函数 引入turtle模块 import turtle turtle的绘图窗体 #setup()设置窗口大小及位置#setup()可省略turtle.setup(width,height,startx,starty) turtle.setup(800,800,0,0) turtle.setup(800,800) turtle的RGB色彩模式 #默认采用小数值 可切换为整数值 #1.0:RGB小数值模式 #255:RGB整数值模式 turtle.colormode(mode) 画

Python中如何用turtle库画出小猪佩奇社会人

首先送上传送门: https://www.zhihu.com/question/275611095/answer/382959285 接下来贴代码 1 from turtle import * 2 3 def nose(x,y):#鼻子 4 penup()#提起笔 5 goto(x,y)#定位 6 pendown()#落笔,开始画 7 setheading(-30)#将乌龟的方向设置为to_angle/为数字(0-东.90-北.180-西.270-南) 8 begin_fill()#准备开始填充

【python】用turtle库画一棵树

# drawtree.py from turtle import Turtle, mainloop def tree(plist, l, a, f): """ plist is list of pens l is length of branch a is half of the angle between 2 branches f is factor by which branch is shortened from level to level.""&

python turtle库

基本教程: # import turtle as t # #画圆 # t.circle(200) # #落笔 # t.pendown()#t.pd() # #提笔 # t.penup()#t.pu() # #画笔宽度 # t.pensize(10) # #设置画笔颜色 # t.color(colorstring) # t.pencolor(colorstring) # #设置画笔背景颜色 # t.color(colorstring1,colorstring2) # #填充开始 # t.begin