python--骷髅头vs.太极图

前言

这几天闲的没事干(居家隔离),随便编了两个代码

骷髅头

示例图

在这里插入图片描述

源代码

import turtle as t
t.speed(0)t.pu()
t.goto(0,200)
t.circle(-130,-80)
t.pd()
t.colormode(255)
t.pensize(5)
t.color(242,232,184)
t.begin_fill()
t.pencolor(0,0,0)
t.circle(-130,160)
t.seth(180)
t.fd(255)
t.end_fill()t.begin_fill()
t.color(221,65,43)
t.pencolor(0,0,0)
t.seth(80)
t.circle(-130,19)
t.seth(0)
t.fd(225)
t.seth(-59)
t.circle(-130,19)
t.seth(180)
t.fd(255)
t.end_fill()t.begin_fill()
t.color(242,232,184)
t.pencolor(0,0,0)
t.fd(60)
t.circle(12,180)
t.fd(375)
t.circle(12,180)
t.fd(255 + 60)
t.end_fill()t.pu()
t.setpos(0,-30)
t.seth(-180)
t.circle(-130,-75)
t.pd()
t.circle(-130,150)t.pu()
t.color(33,24,24)
t.setpos(-45,64)
t.seth(-180)
t.pd()
t.begin_fill()
t.circle(33)
t.pu()
t.setpos(45,64)
t.pd()
t.circle(33)
t.end_fill()t.pu()
t.setpos(0,5)
t.pd()
t.begin_fill()
t.circle(8)
t.end_fill()t.pencolor(0,0,0)
t.pu()
t.setpos(0,0)
t.seth(0)
t.circle(-75,45)
t.pd()
t.circle(-75,270)t.pu()
t.setpos(0,120)
t.seth(0)
t.circle(-105,136)
t.pd()
t.circle(-105,86)t.pu()
t.seth(0)
t.goto(0,200)
t.circle(-130,150)
t.pd()
t.circle(-130,60)t.pu()
t.setpos(-30,-27)
t.seth(260)
t.pd()
t.fd(52)
t.pu()
t.setpos(30,-27)
t.pd()
t.seth(-260)
t.fd(-52)
t.pu()
t.setpos(0,-30)
t.seth(-90)
t.pd()
t.fd(56)t.pu()t.pencolor(0,0,0)
t.setpos(110,145)
t.seth(45)
t.pd()
t.fd(40)
t.seth(135)
t.circle(-30,235)
t.seth(-20)
t.circle(-30,220)
t.seth(-135)
t.fd(40)t.pu()
t.pencolor(0,0,0)
t.setpos(-110,145)
t.seth(135)
t.pd()
t.fd(40)
t.seth(45)
t.circle(30,235)
t.seth(-160)
t.circle(30,220)
t.seth(-45)
t.fd(40)t.pu()
t.setpos(70,-10)
t.seth(-45)
t.pd()
t.fd(70)
t.seth(45)
t.circle(-30,235)
t.seth(-70)
t.circle(-30,255)
t.seth(135)
t.fd(22)t.pu()
t.setpos(-70,-10)
t.seth(-135)
t.pd()
t.fd(70)
t.seth(135)
t.circle(30,235)
t.seth(-110)
t.circle(30,255)
t.seth(45)
t.fd(22)
t.done()

太极图

示例图

有一些bug请忽视

有一些bug请忽视

源代码

import turtledef draw_TJT(R):turtle.pensize(1)turtle.pencolor('black')turtle.speed(0)TJT_color = {1: 'white', -1: 'black'}color_list = [1, -1]for c in color_list:turtle.fillcolor(TJT_color.get(c))turtle.begin_fill()turtle.circle(R / 2, 180)turtle.circle(R, 180)turtle.circle(R / 2, -180)turtle.end_fill()turtle.penup()turtle.goto(0, R / 3 * c)turtle.pendown()turtle.fillcolor(TJT_color.get(-c))turtle.begin_fill()turtle.circle(-R / 6, 360)turtle.penup()turtle.end_fill()turtle.goto(0, 0)turtle.pendown()R = 100
draw_TJT(R)

再见!

在这里插入图片描述


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部