3.3a Use classes
turtle - 是一個 module
這個 module下有二個 class,分別是ScreenandTurtle,class 下又會有 method
Turtle.init
init stands for initialize, what it does is creating a memory for a new object of the class of Turtle
我們使用 brad 去創建這個 object , brad = turtle.Turtle()
brad 就可以 access Turtle 這個 class 所有的 methods
像 forward , right
Screen 的其中一個 method :exitonclick()
點擊後就結束螢幕畫面
turtle.Screen()
The functionScreen()returns a singleton object of aTurtleScreensubclass. This function should be used whenturtleis used as a standalone tool for doing graphics
bgcolor()
range(start,stop,step)
解說 class,建議把 class 想成blueprint,object as an example or instance
,畫出花,三角形等等