2d graphics - drawing a vescica piscis in Python

Matimus mccredie at gmail.com
Tue Jun 17 17:03:48 EDT 2008


On Jun 17, 12: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
> 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:

>>> import Tkinter as tk
>>> can = tk.Canvas()
>>> can.pack(fill=tk.BOTH, expand=True)
>>> c1 = can.create_oval(10,10,110,110)
>>> c2 = can.create_oval(60,10,170,110)

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

Have fun,

Matt



More information about the Python-list mailing list