On 30/12/11 14:12, Stayvoid wrote:
I want to write a program that can draw a figure using the coordinates
specified by the user and calculate its area. An output should be
saved in tiff or png.
What should I use for this?

You have lots of options.

Since you are on a Mac you might want to try using the Mac native libraries or OpenGL. Both are available via the MacPython downloads.

Or more generically you can use one of the several cross-platform GUI toolkits (GTk, Qt, wxPython, Tkinter) - they all have a Canvas widget that allows you to draw figures.

But the easiest option is probably to use the turtle module which
lets you draw graphics using turtle commands (like forward, rioght, left, pen up,down, etc. The documentation has several examples and you can find lots of web pages discussing turtle graphics in general terms.

Calculating the area is probablybest done indepenmdantly of drawing the figure., Store the coordinates, calculate the shape and hyence its area and display the result. You can buuld this as a text based app first or get the turtle stuff working first, it really doesn;t matter which, then stitch the two elements together in a single UI.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to