如何用python畫五角星,如何用python畫一個五角星

時間 2021-06-12 16:06:53

1樓:黑板客

首先要學會python,不然有程式也看不明白啊。

然後就是看你要畫什麼樣的了。簡單的5條線就ok。下面的程式就送你一顆星星。雖然沒有天上的那麼亮。:)

from matplotlib import pyplot as plt

import numpy as np

r = 4.0

def circle_p(r,d):

return [r*np.sin(d/180.0*np.pi),r*np.cos(d/180.0*np.pi)]

wjx_p = [circle_p(r,i*72) for i in range(7)]

for i in range(5):

x = [wjx_p[i][0], wjx_p[i+2][0]]

y = [wjx_p[i][1], wjx_p[i+2][1]]

plt.plot(x,y,'r')

plt.show()

想學python可以搜搜我的課程,用python做些事。

如何用python的turtle畫五角星

2樓:匿名使用者

turtle.seth(angle):只改變海龜的行進方向(角度按逆時針),但不行進,angle為絕對度數

如何採用python語言繪製一個五角星

3樓:育知同創教育

#!/usr/bin/env pythonimport turtle

import time

turtle.forward(100)

turtle.right(144)

time.sleep(1)

turtle.forward(100)

turtle.right(144)

time.sleep(1)

turtle.forward(100)

turtle.right(144)

turtle.forward(100)

time.sleep(1)

turtle.right(144)

turtle.forward(100)

time.sleep(3)

python怎麼畫出一個五角星,要動態效果

4樓:匿名使用者

from turtle import turtlet = turtle();

t.speed(3);

t.pensize(5);

t.color('black','red');

t.begin_fill();

for i in range(5):

t.forward(200);

t.right(144);

t.end_fill();

python中怎麼把五角星畫在中間

5樓:清山鶴

from turtle import *

fillcolor("red")

begin_fill()

while true:

forward(200)

right(144)

if abs(pos()) < 1:

break

end_fill()

執行這段**,會繪製出一個紅色五角星圖形。

碼字不易,望採納。

6樓:匿名使用者

from tkinter import *

import math

base=tk()

canvas=canvas(base,width=1000,height=800,background='grey')

canvas.pack()

center_x=500

center_y=400

r=200

points=[

center_x-int(r*math.sin(2*math.pi/5)),

center_y-int(r*math.cos(2*math.pi/5)),

center_x+int(r*math.sin(2*math.pi/5)),

center_y-int(r*math.cos(2*math.pi/5)),

center_x-int(r*math.sin(math.pi/5)),

center_y+int(r*math.cos(math.pi/5)),

center_x,

center_y-r,

center_x+int(r*math.sin(math.pi/5)),

center_y+int(r*math.cos(math.pi/5)),

]canvas.create_polygon(points,outline='green',fill='yellow')

base.mainloop()

五角星倒是好畫,win螢幕上難,要使用win32螢幕繪圖吧

python2.7繪製五角星 10

7樓:職業人和培訓師

要設定填充色,t.fillcolor("red")import turtle

t = turtle.turtle()

t.fillcolor("red")

t.begin_fill()

t.hideturtle()

t.up()

t.goto(-50, -50)

t.left(36)

t.down()

for i in range(5):

t.forward(200)

t.left(144)

t.end_fill()

如何用python工具編五角星原理

8樓:匿名使用者

#!/usr/bin/env pythonimport turtle

import time

turtle.forward(100)

turtle.right(144)

time.sleep(1)

turtle.forward(100)

turtle.right(144)

time.sleep(1)

turtle.forward(100)

turtle.right(144)

turtle.forward(100)

time.sleep(1)

turtle.right(144)

turtle.forward(100)

time.sleep(3)

五角星怎樣畫的,五角星怎麼畫標準

付費內容限時免費檢視 回答1.用筆在紙上選個中間一點的位置定圓心,然後用圓規,在紙上畫圓 2.穿過圓心畫直線,就像畫圓的直徑那樣 3.以圓心和剛剛畫的直線為起點,以72 為標準,把整個圓劃分為5等分 4.把半徑與圓邊相交的點連線起來,每兩個點中間隔乙個點 5.五角星完成。更多3條 五角星怎麼畫標準 ...

python2 7繪製五角星,python2 7繪製五角星

職業人和培訓師 要設定填充色,t.fillcolor red import turtle t turtle.turtle t.fillcolor red t.begin fill t.hideturtle t.up t.goto 50,50 t.left 36 t.down for i in ran...

怎麼用cad畫五角星,怎麼用CAD畫五角星

畫乙個矩形,再用填充圖案的方法填充,大小比例可以調整。再把沒用的刪除。這只適合不要求尺寸的五角星。如果要求尺寸。如果要求尺寸。你可以先畫乙個和五角星半徑相等的圓,再把圓等分,再連線點,最後再修剪。 我過去覺的下面這種比別的稍微複雜一點點,熟練後都一樣呵呵 用多邊形命令polygon,畫五邊形,然後用...