0
我應該使用一個名爲Dot和Turtle的創建類來繪製一個點。用Python繪製一個點3.5.1 Turtle
class Dot:
def __repr__(self):
return "Dot(" + repr(self.xcoord) + ", " + repr(self.ycoord) + ", " + repr(self.color) + ")"
def __init__(self, xcoord, ycoord, color):
self.xcoord = xcoord
self.ycoord = ycoord
self.color = color
,我試圖通過創建烏龜: 的點與代碼中創建
import turtle
turtle.penup()
def draw():
turtle1.goto(self.xcoord, self.ycoord)
turtle1.dot(5, self.color)
我不知道我在做什麼錯,但烏龜只是坐在那裏,什麼也沒做。誰能幫我?
你忘了叫'draw()'? – zondo