Basil Shubin wrote:
I am currently start a free software project called GFig (A better XFig than XFig :-)).
umm, what's wrong with Skencil? Also check out Xara, it's now open-source.
I like to ask: is there somewere a realy good 2D vector drawing library for wxPython?
It depends what you're looking for. Do checkout wx.lib.FloatCanvas. It uses DCs for drawing, so you don't' get any fancy rendering, but I like to think it has some good features, and I did have in mind that it could be used for X-fig like drawing.
> I just found a wxart2d project that
looks good, but it is not for wxPython only wxWidgets and C++ is supported
And it seems not updated long ago...
Klass is quite active on the wx-users list, so I think it's still supported. Python wrappers for it would be a nice challenge, and contribution to the community ....
Next question is how to implement a on-canvas ruler? What I shall use for making it?
You'll need to tell us more about what you mean by that.
And is there any other 2D drawing app or demos written with wxPython, so I can use it as example/tutorial?
again, wx.lib.floatcanvas. You should get some ideas from that anyway. Send me a note off-line if you want the latest version.
There is no decent 2D graphics library for Python available.
It all depends on what you mean by decent. What features are required here? Rendering as good as Xfig shouldn't be too hard.
Andre Meyer wrote:
Thanks for the pointer. Agg is certainly an excellent 2D library. I
was not aware that it was available in Python. Can it be used for
dynamic interactive graphics, too (I mean real-time graphics with
moving objects, sprites, etc.). PIL is not suited to this kind of
graphics for visualizing processes in simulations, for example. And
does it require Tk?
It doesn't require TK, but it does require moving from a PIL buffer to a wx.Bitmap, which requires a fair bit of copying and takes a while -- i.e. too slow for real interactive use.
However, you can do the interactive stuff with wx.DCs, but render the main image with aggdraw.
Also, these issues should be lessened int eh future. Hopefully, at some point, PIL and wx will both speak the numpy "array interface" so that image data can be transfered back and forth without copying. Also Robin is looking into exposing some of the methods for directly manipulating wx.Bitmap data. Once that's all in place, this could be pretty quick.
Other options:
matplotlib uses Agg also, and you can use the AggCanvas without the rest of MPL if you want. MPL has some C++ code for transferring the buffer into a a wxImage that saves some copying.
Cairo is another option: it has Python bindings, is undergoing a lot of development, and will give you PS, PDF, SVG, etc output to boot.
matplotlib, wx, and chaco are all looking at how to do rendering better in the future. Cairo, Agg and others are all being considered. Depending on your time scale, and how much you want to do loser-level programming, you could either help with one of these efforts or wait for it to be done for you.
A drawing app is a lot of code. The rendering is a small piece of it, so you can do a lot while you wait for or work on a better rendering engine for wx.
-Chris
···
On 7/16/06, Andre Meyer <meyer@acm.org> wrote:
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov