Some inconsistent behaviour by Kturtle

2 views
Skip to first unread message

lior y

unread,
Nov 15, 2009, 4:52:40 PM11/15/09
to KTurtle; an educational programming environment
Hello, my name is Lior and I've started and currently running an
educational program for kids as part of Ilan Ramon Center. The goal of
the program is to develop algorithmic thinking and show basic
mathematics using kturtle. At the moments we have about 400 kids in
the south of Israel.

During preparation, one of the guides in my team noticed some
inconsistent behaviour by kturtle. It's nothing drastic but I wonder
if it might have some side effects or implications.

Here's the code:

reset
penwidth 8

pencolor 0,0,0
repeat 4{
forward 100
turnleft 90
}

turnleft 45
pencolor 0,0,255
repeat 4{
forward 100
turnleft 90
}

turnleft 45
pencolor 0,255,0
repeat 4{
forward 100
turnleft 90
}

turnleft 45
pencolor 255,255,0
repeat 4{
forward 100
turnleft 90
}

turnleft 45
pencolor 255,0,255
repeat 4{
forward 100
turnleft 90
}

turnleft 45
pencolor 0,255,255
repeat 4{
forward 100
turnleft 90
}

turnleft 45
pencolor 127,127,127
repeat 4{
forward 100
turnleft 90
}

turnleft 45
pencolor 127,127,0
repeat 4{
forward 100
turnleft 90
}

so what is going on here?

Niels Slot

unread,
Nov 15, 2009, 5:23:15 PM11/15/09
to kdeedu-...@googlegroups.com
Hi Lior,

Nice to read that you're using KTurtle.

I gave your example program a test drive. The only problem I could see was that the lines drawn last aren't always on top. For example, I see the bue square on top of the yellow square, even though the yellow one got drawn after the blue one did.

The technical reason for this problem is the way we use Qt's Graphics View. For each line the turtle draw we add a line-object to the canvas. Each of these line objects currently has the same 'z-value'. (The 'z-value' determines which object is atop of other objects.) Because we give all objects the same 'z-value' it's up to Qt to decide which line is on top.

A while back I wrote a small patch to increase the 'z-value' for each line we draw. This however had some drawbacks, I should remember to have a chat with Cies about it.

Thanks for your feedback,

Niels

2009/11/15 lior y <lior....@gmail.com>

lior y

unread,
Nov 15, 2009, 5:33:20 PM11/15/09
to KTurtle; an educational programming environment
Thanks for the quick replay.

Lior

On Nov 16, 12:23 am, Niels Slot <nielss...@gmail.com> wrote:
> Hi Lior,
>
> Nice to read that you're using KTurtle.
>
> I gave your example program a test drive. The only problem I could see was
> that the lines drawn last aren't always on top. For example, I see the bue
> square on top of the yellow square, even though the yellow one got drawn
> after the blue one did.
>
> The technical reason for this problem is the way we use Qt's Graphics View.
> For each line the turtle draw we add a line-object to the canvas. Each of
> these line objects currently has the same 'z-value'. (The 'z-value'
> determines which object is atop of other objects.) Because we give all
> objects the same 'z-value' it's up to Qt to decide which line is on top.
>
> A while back I wrote a small patch to increase the 'z-value' for each line
> we draw. This however had some drawbacks, I should remember to have a chat
> with Cies about it.
>
> Thanks for your feedback,
>
> Niels
>
> 2009/11/15 lior y <lior.yo...@gmail.com>
Reply all
Reply to author
Forward
0 new messages