日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

python颜色填充代码_在python tu中用颜色填充形状

發(fā)布時(shí)間:2024/8/5 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python颜色填充代码_在python tu中用颜色填充形状 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

我試著用顏色填充一個(gè)形狀,但是當(dāng)我運(yùn)行它時(shí),它不會(huì)顯示出來(lái)。

我不應(yīng)該用課堂來(lái)做這個(gè)嗎?我不精通python-3,仍然在學(xué)習(xí)如何使用類import turtle

t=turtle.Turtle()

t.speed(0)

class Star(turtle.Turtle):

def __init__(self, x=0, y=0):

turtle.Turtle.__init__(self)

self.shape("")

self.color("")

#Creates the star shape

def shape(self, x=0, y=0):

self.fillcolor("red")

for i in range(9):

self.begin_fill()

self.left(90)

self.forward(90)

self.right(130)

self.forward(90)

self.end_fill()

#I was hoping this would fill the inside

def octagon(self, x=0.0, y=0.0):

turtle.Turtle.__init__(self)

def octa(self):

self.fillcolor("green")

self.begin_fill()

self.left(25)

for x in range(9):

self.forward(77)

self.right(40)

#doesn't run with out this

a=Star()

總結(jié)

以上是生活随笔為你收集整理的python颜色填充代码_在python tu中用颜色填充形状的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。