2d graphics - drawing a vescica piscis in Python

T

Terrence Brannon

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
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.

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.
 
M

Mensanator

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.
 
M

Matimus

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
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.

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.

I would just draw on the tk canvas:

You can draw cross hatching using can.create_line(...).

Have fun,

Matt
 
L

Lie

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
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.

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.

For an alternative to turtle, you might want to see PIL (Python
Imaging Library) or perhaps pygame.
 
T

Terrence Brannon

Hello, I have written a program to draw a vescica piscis <http://
en.wikipedia.org/wiki/Vesica_piscis>

actually, I mis-spelled the term. It should be vesica piscis or vesica
pisces. I put a "c" after the "s" -- vescica --- and that is wrong and
made it hard for me to find this post the next day.

now others will be able to search the archives and find it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top