2d graphics - drawing a vescica piscis in Python

Mensanator mensanator at aol.com
Tue Jun 17 16:36:29 EDT 2008


On Jun 17, 2:45 pm, Terrence Brannon <metap... at gmail.com> wrote:
> Hello, I have written a program to draw a vescica piscis <http://
> en.wikipedia.org/wiki/Vesica_piscis>
>
> from turtle import *
>
> def main():
>     setup(width=400, height=400)
>
>     r = 50
>     color("black")
>     circle(r)
>     color("white")
>     forward(r)
>     color("black")
>     circle(r)
>     x = raw_input('please enter a string:')
>
> if __name__ == '__main__':
>     main()
>
> ... but I would like the following:
>
> 1 - I dont like how the bottom of the first circle is not complete

Because you overwrote that portion of the circle when
you changed the color to white.

Instead, you should have done up() (which lifts the pen)
and then down() after you've moved to the start of the
second circle. No need to change the pen color.

> 2 - I would like for the left circle to be filled with verticle lines
> and the right circle to be filled with horizontal lines, so that the
> vescica piscis is cross-hatched.

That would be the fill() command, but it's not documented
how to fill with anything other than a solid color.

>
> And finally, is turtle the "best" option for what I'm doing? pyCairo
> looked a bit hard to get going with, but very powerful. sping looked a
> bit alpha/beta.




More information about the Python-list mailing list