python颜色填充代码_在python tu中用颜色填充形状
我試著用顏色填充一個(gè)形狀,但是當(dāng)我運(yùn)行它時(shí),它不會(huì)顯示出來。
我不應(yīng)該用課堂來做這個(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)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 梦幻花园成就完成情况怎么查看
- 下一篇: 广州公司聚餐餐厅好去处介绍(广州十大宴请