[EMAIL PROTECTED] schrieb:
> Vern,
>
> This is really great. I like that you can drive the turtle in a purely
> imperative style. But I also like that you can make hundreds of
> turtles if you want.
>
> My question: Is there a way to do away with the original turtle so that
> if you are working with multiple turtles they are all objects instead
> some as objects and the one as 'mysterious invisible object'?
>
Hello Brad,
"the one" is not a 'mysterious invisible object' but a mysteriaous unnamed
object. When working with the turtle module it sometimes erroneously happens
that one has several explicitely created turtles (i. e. Pen objects) an the one
unnamed, which could e.g. be created by calling a turtle function.
if one had a function like this:
def thispen():
return _pen
one could get a handle for this pen. Try it out. Put it into the module,
then
>>> from turtle import *
>>> forward(100) # draws a line
>>> p = thispen()
>>> p.left(90); p.forward(100) # the same turtle draws again
The reason for this is, that names, which begin with an underline cannot be
imported with the import statement above. (And that was the intention for that
naming.)
But it can be imported this way:
>>> from turtle import _pen as q
>>> q.left(90); ... etc
Of course it's ugly to have programs with expicitly created Pen objects and the
anonymous turtle intermixed. But that can easily be avoided by the programmer.
Only in the interactive mode this situation occurs sometimes unintentionally.
In
this case the above mentioned resorts may help.
Regards,
Gregor
> Brad
>
>
> >
>
>
--
Gregor Lingl
Reisnerstrasse 3/19
A-1030 Wien
Telefon: +43 1 713 33 98
Mobil: +43 664 140 35 27
Website: python4kids.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"edupython" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/edupython
-~----------~----~----~----~------~----~------~--~---