473,765 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2d graphics - drawing a vescica piscis in Python

Hello, I have written a program to draw a vescica piscis <http://
en.wikipedia.or g/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('plea se 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.
Jun 27 '08 #1
4 2115
On Jun 17, 2:45*pm, Terrence Brannon <metap...@gmail .comwrote:
Hello, I have written a program to draw a vescica piscis <http://
en.wikipedia.or g/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('plea se 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.
Jun 27 '08 #2
On Jun 17, 12:45*pm, Terrence Brannon <metap...@gmail .comwrote:
Hello, I have written a program to draw a vescica piscis <http://
en.wikipedia.or g/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('plea se 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
Jun 27 '08 #3
Lie
On Jun 18, 2:45*am, Terrence Brannon <metap...@gmail .comwrote:
Hello, I have written a program to draw a vescica piscis <http://
en.wikipedia.or g/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('plea se 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.
Jun 27 '08 #4
On Jun 17, 3:45*pm, Terrence Brannon <metap...@gmail .comwrote:
Hello, I have written a program to draw a vescica piscis <http://
en.wikipedia.or g/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.
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2386
by: Sanjay | last post by:
hi, We are currently porting our project from VB6 to VB .NET. Earlier we used to make scale transformations on objects like pictureBox , forms etc.Now Such transformations are made on the graphics object of the form/pictureBox. Should It be better if make a graphics object from my pictureBox in load event handler of the form and store it as member variable of the form , make
1
9577
by: Paul Hoad | last post by:
I'm trying to use MeasureString() to determine the length in pixels of a string However to do I need a System.Drawing.Graphics object to do this I need to create a System.Drawing.Graphics object for which there is only two constructors System.Drawing.Graphics.FromHdc
5
20292
by: Vin | last post by:
Hi, I am using the following code to draw whatever the user draws using x,y. // draws lines directly on a winform. CreateGraphics().DrawLine(APen, x, y, OldX, OldY); Now how do I save the drawing on to a bmp file on my harddisk? C# code in this regard would be very helpful. I tried all forums but invain.
1
3234
by: Hadar | last post by:
Hi, I'm getting "object is currently in use elsewhere" when I use System.Drawing.Graphics.MesureString. This is what I do: My controls use a utility class the helps it to mesure strings. To get the best performance for the utility class, its members, as well as the System.Drawing.Graphics object, are static:
8
3327
by: Nathan Sokalski | last post by:
I am trying to write code to rotate a graphic that I have. Here is the code I am currently using: Dim frogbitmap As New Bitmap(Drawing.Image.FromFile(Server.MapPath("images/frog.gif"))) Dim froggraphic As Graphics = Graphics.FromImage(frogbitmap) froggraphic.RotateTransform(90) frogbitmap.Save(Server.MapPath("images/frog2.gif"), Imaging.ImageFormat.Gif)
7
3037
by: Michael Galvin | last post by:
I am trying to use Python to send to the printer a calender filled with a mix of text and simple graphics. I want to draw on the printed page something like a table with 6 rows and 7 columns to represent a calendar. I want to place text precisely within those boxes on the printed page. I am using Python 2.4 on Windows XP I was in the past able to do this within Visual Basic using its printer object. Visual Basic's printer object uses...
6
3245
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument (much like the current model), but my PrintDocument would have a Pages collection such that each time you need to have an additional page, you would just add another page to the collection and then use the page object for the actual drawing etc. ...
2
1548
by: jediknight | last post by:
Hi, I am designing a web form which as an imagemap. I need to obtain a graphics object so I can draw on this imagemap. Can anyone tell me how to do this? I have tried creating a bitmap object and doing Graphics.FromImage call but the image on the imagemap disappears leaving a black background.
0
3556
by: Hasim AH | last post by:
Hi .. Just getting interested to learn C# and needs help. I want to write C# application so that the program will execute and draw graphics when the user select the drawing menu from the main menu, SigDraw. Here is the codes:- using System; using System.Drawing; using System.Collections;
0
9566
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9393
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7371
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6646
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5272
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5413
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2800
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.