摘要:本文將利用畫多種不同的表白圖,附上源碼,表白代碼看這一篇文章就夠啦,總有你喜歡的,喜歡的話別忘記三連了。
本文將利用Python畫多種不同的表白圖,附上源碼,表白代碼看這一篇文章就夠啦,總有你喜歡的,喜歡的話別忘記三連了。
import turtle turtle.bgcolor("black")turtle.pensize(2)sizeh = 1.2 def curve(): for ii in range(200): turtle.right(1) turtle.forward(1 * sizeh) turtle.speed(0)turtle.color("red", "red")turtle.begin_fill()turtle.left(140)turtle.forward(111.65 * sizeh)curve()turtle.left(120)curve()turtle.forward(111.65 * sizeh)turtle.end_fill()turtle.hideturtle()
import timewords = input("請(qǐng)輸出想要表達(dá)的文字:")#例子:words = "Dear lili, Happy Valentine"s Day! Lyon Will Always Love You Till The End! ? Forever! ?"for item in words.split(): #要想實(shí)現(xiàn)打印出字符間的空格效果,此處添加:item = item+" " letterlist = []#letterlist是所有打印字符的總list,里面包含y條子列表list_X for y in range(12, -12, -1): list_X = []#list_X是X軸上的打印字符列表,里面裝著一個(gè)String類的letters letters = ""#letters即為list_X內(nèi)的字符串,實(shí)際是本行要打印的所有字符 for x in range(-30, 30):#*是乘法,**是冪次方 expression = ((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3 if expression <= 0: letters += item[(x-y) % len(item)] else: letters += " " list_X.append(letters) letterlist += list_X print("/n".join(letterlist)) time.sleep(1.5);
但是,有點(diǎn)太單調(diào)了點(diǎn),來,將代碼簡(jiǎn)單改造一下,實(shí)現(xiàn)動(dòng)態(tài)輸出心形的,代碼如下:
import timewords = input("請(qǐng)輸出想要表達(dá)的文字:")for item in words.split(): print("/n".join(["".join([(item[(x-y) % len(item)] if ((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3 <= 0 else " ") for x in range(-30, 30)]) for y in range(12, -12, -1)])) time.sleep(1.5)
from turtle import*color ("black","red")pensize(5)begin_fill()penup()goto(50,50)pendown()right(45)goto(100,0)left(90)fd(120)circle(50,225)penup()goto(0,0)pendown()left(135)fd(120)circle(50,225)seth(90)circle(50,225)fd(121)end_fill()left(56)penup()goto(-210,40)pendown()goto(0,80)penup()goto(160,110)pendown()goto(320,140)done()
#2.14from turtle import *from time import sleep def go_to(x, y): up() goto(x, y) down() def head(x,y,r): go_to(x,y) speed(1) circle(r) leg(x,y) def leg(x,y): right(90) forward(180) right(30) forward(100) left(120) go_to(x,y-180) forward(100) right(120) forward(100) left(120) hand(x,y) def hand(x,y): go_to(x,y-60) forward(100) left(60) forward(100) go_to(x, y - 90) right(60) forward(100) right(60) forward(100) left(60) eye(x,y) def eye(x,y): go_to(x-50,y+130) right(90) forward(50) go_to(x+40,y+130) forward(50) left(90) def big_Circle(size): speed(20) for i in range(150): forward(size) right(0.3)def line(size): speed(1) forward(51*size) def small_Circle(size): speed(10) for i in range(210): forward(size) right(0.786) def heart(x, y, size): go_to(x, y) left(150) begin_fill() line(size) big_Circle(size) small_Circle(size) left(120) small_Circle(size) big_Circle(size) line(size) end_fill() def main(): pensize(2) color("red", "pink") head(-120, 100, 100) heart(250, -80, 1) go_to(200, -300) write("To: 智慧與美貌并存的", move=True, align="left", font=("楷體", 20, "normal")) done() main()
from turtle import *import time setup(1000,800,0,0)speed(0)penup()seth(90)fd(340)seth(0)pendown() speed(5)begin_fill()fillcolor("red")circle(50,30) for i in range(10): fd(1) left(10) circle(40,40) for i in range(6): fd(1) left(3) circle(80,40) for i in range(20): fd(0.5) left(5) circle(80,45) for i in range(10): fd(2) left(1) circle(80,25) for i in range(20): fd(1) left(4) circle(50,50) time.sleep(0.1) circle(120,55) speed(0) seth(-90)fd(70) right(150)fd(20) left(140)circle(140,90) left(30)circle(160,100) left(130)fd(25) penup()right(150)circle(40,80)pendown() left(115)fd(60) penup()left(180)fd(60)pendown() end_fill() right(120)circle(-50,50)circle(-20,90) speed(1)fd(75) speed(0)circle(90,110) penup()left(162)fd(185)left(170)pendown()circle(200,10)circle(100,40)circle(-52,115)left(20)circle(100,20)circle(300,20)speed(1)fd(250) penup()speed(0)left(180)fd(250)circle(-300,7)right(80)circle(200,5)pendown() left(60)begin_fill()fillcolor("green")circle(-80,100)right(90)fd(10)left(20)circle(-63,127)end_fill() penup()left(50)fd(20)left(180) pendown()circle(200,25) penup()right(150) fd(180) right(40)pendown()begin_fill()fillcolor("green")circle(-100,80)right(150)fd(10)left(60)circle(-80,98)end_fill() penup()left(60)fd(13)left(180) pendown()speed(1)circle(-200,23) exitonclick()
Python小游戲源碼,畫皮卡丘,哆啦A夢(mèng)等源碼分享點(diǎn)擊領(lǐng)取.福利多多。
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://specialneedsforspecialkids.com/yun/119306.html
摘要:前言大家好,這里是平頭哥聯(lián)盟,我是首席背鍋官松鼠,今天要分享的是最給一些還沒入門的同學(xué)或需要提升的同學(xué)一些指引詳細(xì)說明自己這幾年來經(jīng)歷怎么一步一步轉(zhuǎn)型給大家一個(gè)參考希望可以少走些彎路寫在最前由平頭哥聯(lián)盟測(cè)試同學(xué)整理作者首席背鍋官松鼠交流群 showImg(https://segmentfault.com/img/bVbksdn?w=1278&h=722); 前言 ? 大家好,這里是@...
摘要:完整的資料源碼都打包等你來取哈免費(fèi)滴直接視頻效果展示如下紀(jì)念冊(cè)哪些浪漫至極的表白程序截圖展示如下界面漫天花瓣飛舞。 ?導(dǎo)語 大家好,我是木木子!?? 今日的表白案例上線啦~有沒有期待?安排安排!源碼基地見免費(fèi)源碼哈! 貼心的木子君也給你們好多愛心花瓣、以及表白的小程序!在主頁(yè)的左側(cè)哦! 這款...
摘要:整理的一些實(shí)用的類網(wǎng)站及工具。鏈接云適配有時(shí)候我們做出的網(wǎng)站沒有用到響應(yīng)式布局,也可能我們的網(wǎng)站的像素寬度已經(jīng)規(guī)定成具體的多少像素了。同時(shí)提供多個(gè)開放,功能實(shí)用,非常強(qiáng)大。 整理的一些實(shí)用的IT類網(wǎng)站及工具。 1.聚合數(shù)據(jù) 大家在開發(fā)過程中,可能會(huì)用到各種各樣的數(shù)據(jù),想找一些接口來提供一些數(shù)據(jù)。比如天氣預(yù)報(bào)查詢,火車時(shí)刻表查詢,彩票查詢,身份證查詢等等。有了這個(gè)接口,直接調(diào)用即可。各種...
摘要:時(shí)間永遠(yuǎn)都過得那么快,一晃從年注冊(cè),到現(xiàn)在已經(jīng)過去了年那些被我藏在收藏夾吃灰的文章,已經(jīng)太多了,是時(shí)候把他們整理一下了。那是因?yàn)槭詹貖A太亂,橡皮擦給設(shè)置私密了,不收拾不好看呀。 ...
閱讀 1208·2021-09-30 09:47
閱讀 3758·2021-09-06 15:02
閱讀 1765·2021-09-01 10:46
閱讀 2353·2019-08-30 15:52
閱讀 587·2019-08-29 15:28
閱讀 1867·2019-08-29 15:08
閱讀 1142·2019-08-29 13:28
閱讀 2565·2019-08-29 12:19