2D vector drawing library for wxPython

Hi folks,

I am currently start a free software project called GFig (A better XFig than XFig :-)). As I am newbie free software developer (sounds cool, is't it? ;-)), so I like to ask: is there somewere a realy good 2D vector drawing library for wxPython? I just found a wxart2d project that looks good, but it is not for wxPython only wxWidgets and C++ is supported :frowning: And it seems not updated long ago...
Next question is how to implement a on-canvas ruler? What I shall use for making it? Make it as custom widget or maybe there any other solution?
And is there any other 2D drawing app or demos written with wxPython, so I can use it as example/tutorial?

Thank in advance and hope on yours help!

Hi Basil

There is no decent 2D graphics library for Python available. It would
be great if you were willing to help out with this. There were recent
discussions on this on this list, see the threads on "transparent
drawing" and "Integration of PyGame questions" and older ones.

thanks and success
André

···

On 7/16/06, Basil Shubin <bashu@yandex.ru> wrote:

Hi folks,

I am currently start a free software project called GFig (A better XFig
than XFig :-)). As I am newbie free software developer (sounds cool,
is't it? ;-)), so I like to ask: is there somewere a realy good 2D
vector drawing library for wxPython? I just found a wxart2d project that
looks good, but it is not for wxPython only wxWidgets and C++ is
supported :frowning: And it seems not updated long ago...
Next question is how to implement a on-canvas ruler? What I shall use
for making it? Make it as custom widget or maybe there any other solution?
And is there any other 2D drawing app or demos written with wxPython, so
I can use it as example/tutorial?

Thank in advance and hope on yours help!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

That is not correct, have a look at aggdraw:
http://effbot.org/zone/draw-agg.htm

Peter

···

On 7/16/06, Andre Meyer meyer@acm.org wrote:

There is no decent 2D graphics library for Python available.

Peter Damoc wrote:

···

On 7/16/06, *Andre Meyer* <meyer@acm.org <mailto:meyer@acm.org>> wrote:

    There is no decent 2D graphics library for Python available.

That is not correct, have a look at aggdraw:
http://effbot.org/zone/draw-agg.htm

Hmm... And how I can use it in wxPython apps? Is it still need some work on integration into wxPython?

Hi Peter

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?

regards
André

···

On 7/16/06, Peter Damoc <pdamoc@gmail.com> wrote:

On 7/16/06, Andre Meyer <meyer@acm.org> wrote:
> There is no decent 2D graphics library for Python available.
>

That is not correct, have a look at aggdraw:
http://effbot.org/zone/draw-agg.htm

Peter

--
Dr. Andre P. Meyer http://python.openspace.nl/meyer
TNO Defence, Security and Safety http://www.tno.nl/
Delft Cooperation on Intelligent Systems http://www.decis.nl/

Ah, this is obviously some strange usage of the word 'safe' that I
wasn't previously aware of. - Douglas Adams

No, it does not require Tk.
I have never tested performance on the toolkit… I have no idea how would it behave in a dynamic situation… the wx.Image ->PIL->Aggdraw->wxImage combo would be a performance killer…

Only test will tell if it is ok. :slight_smile:

···

On 7/16/06, Andre Meyer meyer@acm.org wrote:

Hi Peter

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?

regards
André

On 7/16/06, Peter Damoc < > pdamoc@gmail.com> wrote:

On 7/16/06, Andre Meyer meyer@acm.org wrote:

There is no decent 2D graphics library for Python available.

That is not correct, have a look at aggdraw:
http://effbot.org/zone/draw-agg.htm

Peter

Dr. Andre P. Meyer http://python.openspace.nl/meyer
TNO Defence, Security and Safety http://www.tno.nl/

Delft Cooperation on Intelligent Systems http://www.decis.nl/

Ah, this is obviously some strange usage of the word ‘safe’ that I
wasn’t previously aware of. - Douglas Adams


Peter Damoc
Lead developer for
Inamed CAIS Planning System
http://www.cms.ro/cais/

You have to use PIL (you can get it from the same place)
Check the wxpython wiki for PIL-wxpython integration

Peter

···

On 7/16/06, Basil Shubin bashu@yandex.ru wrote:

Hmm… And how I can use it in wxPython apps? Is it still need some work
on integration into wxPython?

Hi Andre,

I am not sure I understand what you want to do, but have you looked at matplotlib?

It has different backends, one of which is wxAgg.

Werner

Andre Meyer wrote:

···

Hi Peter

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?

regards
André

On 7/16/06, Peter Damoc <pdamoc@gmail.com> wrote:

On 7/16/06, Andre Meyer <meyer@acm.org> wrote:
> There is no decent 2D graphics library for Python available.
>

That is not correct, have a look at aggdraw:
http://effbot.org/zone/draw-agg.htm

Peter

Hi Werner

In fact, I have been following matplotlib for a while and will certainly use it for creating diagrams for simulation evaluations. However, for live dynamic graphics I chose for PyGame within wxPython and it works quite well (supports double-buffering, sprites, etc., not too much advanced 2D graphics, though, like anti-aliasing, shapes, nurbs, etc.). PyGame allows to control moving objects within the 2D scene, which is what I need for visualising simulations while they are running. Also experimented with OpenGL in wxPython in the past and it worked fine, too.

hope this clarifies my previous statement
André

···

On 7/16/06, Werner F. Bruhin <werner.bruhin@free.fr > wrote:

Hi Andre,

I am not sure I understand what you want to do, but have you looked at

matplotlib?

http://matplotlib.sourceforge.net/

It has different backends, one of which is wxAgg.

Werner

Andre Meyer wrote:

Hi Peter

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?

regards
André

On 7/16/06, Peter Damoc pdamoc@gmail.com wrote:

On 7/16/06, Andre Meyer meyer@acm.org wrote:

There is no decent 2D graphics library for Python available.

That is not correct, have a look at aggdraw:

http://effbot.org/zone/draw-agg.htm

Peter


To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org


Dr. Andre P. Meyer http://python.openspace.nl/meyer
TNO Defence, Security and Safety http://www.tno.nl/

Delft Cooperation on Intelligent Systems http://www.decis.nl/

Ah, this is obviously some strange usage of the word ‘safe’ that I wasn’t previously aware of. - Douglas Adams

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 :frowning: 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

You may want to look at our (Enthought's) package Kiva. It provides fast integration with wx, uses agg as its backend, so you get all of the nice alpha blending and high quality output that agg offers, but it's much easier to use than raw agg. In fact, we use it as the backend to our plotting package Chaco. (and now Chaco2) The specific interface we've implemented is a takeoff on DisplayPDF which is the 2D interface used in OS X. There is a version on our website you can download at code.enthought.com, but I would recommend that you use the version in SVN as it is better and more recent.

Best Regards,

-Dave

Andre Meyer wrote:

···

Hi Werner

In fact, I have been following matplotlib for a while and will certainly use it for creating diagrams for simulation evaluations. However, for live dynamic graphics I chose for PyGame within wxPython and it works quite well (supports double-buffering, sprites, etc., not too much advanced 2D graphics, though, like anti-aliasing, shapes, nurbs, etc.). PyGame allows to control moving objects within the 2D scene, which is what I need for visualising simulations while they are running. Also experimented with OpenGL in wxPython in the past and it worked fine, too.

hope this clarifies my previous statement
André

On 7/16/06, *Werner F. Bruhin* <werner.bruhin@free.fr > <mailto:werner.bruhin@free.fr>> wrote:

    Hi Andre,

    I am not sure I understand what you want to do, but have you
    looked at
    matplotlib?

    http://matplotlib.sourceforge.net/

    It has different backends, one of which is wxAgg.

    Werner

    Andre Meyer wrote:

    > Hi Peter
    >
    > 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?
    >
    > regards
    > André
    >
    > On 7/16/06, Peter Damoc <pdamoc@gmail.com > <mailto:pdamoc@gmail.com>> wrote:
    >
    >> On 7/16/06, Andre Meyer <meyer@acm.org <mailto:meyer@acm.org>> > wrote:
    >> > There is no decent 2D graphics library for Python available.
    >> >
    >>
    >> That is not correct, have a look at aggdraw:
    >> http://effbot.org/zone/draw-agg.htm
    >>
    >> Peter
    >>
    >

    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    wxPython-users-unsubscribe@lists.wxwidgets.org
    <mailto:wxPython-users-unsubscribe@lists.wxwidgets.org>
    For additional commands, e-mail:
    wxPython-users-help@lists.wxwidgets.org
    <mailto:wxPython-users-help@lists.wxwidgets.org>

--
Dr. Andre P. Meyer http://python.openspace.nl/meyer
TNO Defence, Security and Safety http://www.tno.nl/
Delft Cooperation on Intelligent Systems http://www.decis.nl/

Ah, this is obviously some strange usage of the word 'safe' that I wasn't previously aware of. - Douglas Adams