python绘制立体玫瑰花表白(python画玫瑰花)

http://www.itjxue.com  2023-03-18 11:33  来源:未知  点击次数: 

怎么用python画玫瑰花,求大神贴代码,感激不尽

import?turtle

#?设置初始位置

turtle.penup()

turtle.left(90)

turtle.fd(200)

turtle.pendown()

turtle.right(90)

#?花蕊

turtle.fillcolor("red")

turtle.begin_fill()

turtle.circle(10,?180)

turtle.circle(25,?110)

turtle.left(50)

turtle.circle(60,?45)

turtle.circle(20,?170)

turtle.right(24)

turtle.fd(30)

turtle.left(10)

turtle.circle(30,?110)

turtle.fd(20)

turtle.left(40)

turtle.circle(90,?70)

turtle.circle(30,?150)

turtle.right(30)

turtle.fd(15)

turtle.circle(80,?90)

turtle.left(15)

turtle.fd(45)

turtle.right(165)

turtle.fd(20)

turtle.left(155)

turtle.circle(150,?80)

turtle.left(50)

turtle.circle(150,?90)

turtle.end_fill()

#?花瓣1

turtle.left(150)

turtle.circle(-90,?70)

turtle.left(20)

turtle.circle(75,?105)

turtle.setheading(60)

turtle.circle(80,?98)

turtle.circle(-90,?40)

#?花瓣2

turtle.left(180)

turtle.circle(90,?40)

turtle.circle(-80,?98)

turtle.setheading(-83)

#?叶子1

turtle.fd(30)

turtle.left(90)

turtle.fd(25)

turtle.left(45)

turtle.fillcolor("green")

turtle.begin_fill()

turtle.circle(-80,?90)

turtle.right(90)

turtle.circle(-80,?90)

turtle.end_fill()

turtle.right(135)

turtle.fd(60)

turtle.left(180)

turtle.fd(85)

turtle.left(90)

turtle.fd(80)

#?叶子2

turtle.right(90)

turtle.right(45)

turtle.fillcolor("green")

turtle.begin_fill()

turtle.circle(80,?90)

turtle.left(90)

turtle.circle(80,?90)

turtle.end_fill()

turtle.left(135)

turtle.fd(60)

turtle.left(180)

turtle.fd(60)

turtle.right(90)

turtle.circle(200,?60)

运行结果:

用Python matplotlib 怎么画风向玫瑰图 能给出程序的

import?numpy?as?np

import?matplotlib.pyplot?as?plt

N?=?20

theta?=?np.linspace(0.0,?2?*?np.pi,?N,?endpoint=False)

radii?=?10?*?np.random.rand(N)

width?=?np.pi?/?4?*?np.random.rand(N)

ax?=?plt.subplot(111,?projection='polar')

bars?=?ax.bar(theta,?radii,?width=width,?bottom=0.0)

#?Use?custom?colors?and?opacity

for?r,?bar?in?zip(radii,?bars):

????bar.set_facecolor(plt.cm.jet(r?/?10.))

????bar.set_alpha(0.5)

plt.show()

差不多上面代码的原理,具体的自己照着官方文档改

求编写一个表白程序?

JAVA

传说中规范的爱情代码(2010-11-10 21:37:36)

转载

标签:it

private final static DEPOSIT = 100000;

private final static FELLING = 8;

public void love(boy, girl) {

Boolean isMarried = false;

if(boy.有房() boy.有车()) {

doMarry(boy, girl);

isMarried = true;

} else if(girl.愿意等()) {

while(!(boy.赚钱 DEPOSIT girl.感情 FELLING)) {

for(int day=1; day =365; day++) {

if( day == 情人节 ) {

if(boy.givegirl(玫瑰)) {

girl.感情++;

} else {

girl.感情--;

}

}

if(day == girl.生日) {

if( boy.givegirl(玫瑰) )

{

girl.感情++;

}

else {

girl.感情--;

boy.拼命赚钱();

}

}

}

if(boy.有房() boy.有车()) {

doMarry(boy, girl);

isMarried = true;

break;

}

年龄++;

girl.感情--;

}

}

if(!IsMarried) {

girl.goto(another_boy);

}

private void doMarry(boy, girl) {

boy.set(nothing);

girl.嫁给(boy);

}

(责任编辑:IT教学网)

更多

推荐Fireworks教程文章