Reflection of class on Nov 10th
In last class, I have
leant about how to use turtle module to output simple polygons and further complex
combinations by inputting corresponding instructions in Python 3, but I cannot
use turtle module to output another normal shape, circle.
As we all know, if
we want to design some fabulous artificial images, circle is the one of the
most integral shapes so that I need learn how to output a circle by turtle
module. Well, I have got it and utilize it with different polygons to design
some interesting images like hexagram after today’s learning of chapter 2.
In this chapter,
circle command is the basic instruction that I can use it by adding radius and
extent to create various circles and adding steps and radius to create
different polygons which fits in a circle with different radius, that is, more
steps the polygons have, more similar as the circle they are. In addition, I
can set pen color before I draw the outline of shapes and add color to these
various shapes by using begin-fill and end-fill commands which tell the turtle
when to start filling from and then when to end filling. And I can also hide
the turtle icon when the color filling is ending by using hide-turtle command.
For repetition, I
think I just need create a simple loop to achieve that so it’s not a problem, what
I’m interested is the two different ways to describe turtle import. I always
use “from turtle import *” command before I begin using turtle module because I
don’t need to put “turtle.” in front of every function name which I want to use
from the turtle module, it helps me a lot to save time on coding a procedure. But
now I know this convenient way does have problem on using the same function
name which may be imported from my own defined function. Instead, I can use “import
turtle” directly to figure it out.
As well, I finished
all the challenges and created a complex hexagram as I have shown you in class
later. But the only drawback was that I used too many repeated statements to
achieve that. And I’ll try my best to improve the relative codes in next class.
No comments:
Post a Comment