[Edu-sig] turtle: properties instead of setters/getters ?

Jurgis Pralgauskis jurgis.pralgauskis at gmail.com
Tue Apr 28 23:56:18 CEST 2015


Trinket.io now proposes turtle graphics with good feature -- image rotation
while turning (which is absent in TK)......
http://blog.trinket.io/using-images-in-turtle-programs/
so you can try it without installing Py locally :)


There is nice collection of over 50 examples:
https://code.google.com/p/python-turtle-demo/downloads/list


On Mon, Apr 27, 2015 at 7:07 PM, Sebastian Silva <sebastian at fuentelibre.org>
wrote:

>  Hi,
> I also teach game programming to kids, but haven't used the turtle module.
>
> I collect and sometimes translate some resources to spanish here:
> http://pe.sugarlabs.org/ir/Python
>
> I don't know if this is the right forum but I wanted to chime in to say +1
> and curious to see how such a requests works within the Python community.
>
> Best regards
> Sebastian
>
>
>
> On 27/04/15 10:36, Jurgis Pralgauskis wrote:
>
> The same would apply to many other properties:
>
> y
> heading
>  position
>
>  speed
>  pensize
>
>  color
> shape
> shear
> tilt
> visible
>
>  maybe sth else..
>
>
>
>
> On Mon, Apr 27, 2015 at 6:19 PM, Jurgis Pralgauskis <
> jurgis.pralgauskis at gmail.com> wrote:
>
>> Hi,
>>
>>  turtle module is nice way to introduce to Python,
>> but, if I want to increase x by 10, I have to write
>>
>>  t.setx( t.xcor() + 1)
>>
>>  which is uglier (and not beginner friendly) than common:
>> t.x = t.x + 1
>>
>>  beginners tend to forget () after xcor and so on...
>>
>>  This could be achieved with  several property
>> <https://docs.python.org/3/library/functions.html#property>/decorator
>> lines
>> Would it be possible for Py 3.5? :)
>>
>>
>>  ps.: I teach programming games,
>> and more robust expressions (for collision checking) would look cleaner:
>> if ball.x-5 > box.x-10   and  ball.x+5 < box.x+10:
>>       ball.x =100
>>
>>  instead of
>>  if ball.xcor()-5 > box.xcor()-10   and  ball.xcor()+5 < box.xcor()+10:
>>      ball.setx( 100 )
>>
>>  pps.:
>> I don't know how would default turtle instance behave
>> could I then write     x = x + 1
>>  instead of          setx( xcor() + 1)
>> ?
>>
>>
>>  --
>> Jurgis Pralgauskis
>> tel: 8-616 77613;
>> Don't worry, be happy and make things better ;)
>> http://galvosukykla.lt
>>
>
>
>
>  --
> Jurgis Pralgauskis
> tel: 8-616 77613;
> Don't worry, be happy and make things better ;)
> http://galvosukykla.lt
>
>
> _______________________________________________
> Edu-sig mailing listEdu-sig at python.orghttps://mail.python.org/mailman/listinfo/edu-sig
>
>
> --
> I+D SomosAzucar.Org
> "icarito" #somosazucar en Freenode IRC
> "Nadie libera a nadie, nadie se libera solo. Los seres humanos se liberan en comunión" - P. Freire
>
>


-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20150429/5066d7ae/attachment.html>


More information about the Edu-sig mailing list