From: Chris B. <Chr...@no...> - 2004-09-17 15:29:51
|
AP Meyer wrote: > My problem is to visualise the process of a simulation, thus vector > graphics objects controlled by a simulation program. At the moment I use > a Tkinter Canvas, but it is very limiting. Look at the attached image > for an example: cars driving on roads and trying to avoid crashing > (Windows version). Imagine the cars driving around, of course! Did you post a similar message to comp.lang.python? Anyway, I tried to reply to that, but maybe you didn't see it. I would suggest my wxPython FloatCanvas package: http://home.comcast.net/~chrishbarker/FloatCanvas/ (it's also included with recent versions of wxPython) Sorry I don't have a really nifty page describing it, but it does come with a fairly comprehensive demo. I'd describe it's core mission as such: * It is designed to display data, which are likely to be in arbitrary coordinates, rather than a picture, but is not a plotting tool (axes and all that) * It is object based, and thus separates you from most of the need to understand drawing with wx (DCs and all), and lets you create and maintain objects. * It is designed to be high performance enough for simple animation > What I need is something similar to the Java2D API or JGraph. I need With a quick glance at the Java2D page, I can say that it has a slightly different mission, but the biggest issues are: - No OpenGL (but I'd love to see that!) - No printing (though I was given a patch that I have not had a chance to integrate yet. It shouldn't be too hard) - Not as mature or Robust (maybe a half a dozen people are using it for real) As for your requirements: > - interactive (by application, not user) creation and modification of > graphics primitives, such as: circles - yes text - yes rects - yes arcs - no, but it wouldn't be hard to add arrows - yes, but not in the released version--hopefully I'll get anew one out soon, otherwise, I can send it to you directly. > splines, etc. -- no, but same as arcs. > - transparency (alpha blending) - No (this is NOT well supported by wx yet, :-( ) > - anti-aliasing -- I think text is covered, but These two could be supported by AGG, which is used by matplotlib. There was some talk a while back about creating a wxAggDC, which I could then use for FloatCanvas, but no one has stepped up to do it yet! Would you like to? > - rotation, skewing, scaling, etc. -- some,a nd it wouldn't be hard to add more. > - SVG output -- nope wxArt2d (A C++ library for wx) has a lot of this. It would be great to see it wrapped for Python, unfortunately, not a trivial job, as I understand it. Question: do you need it to be user-interactive, i.e. events responding to clicking on objects? FloatCanvas does have that. > I have already looked at Tkinter and wxPython/OGL, but neither seems to > do what I want. I'm afraid you're going to have to adapt anything that exists for Python, the libraries just aren't as comprehensive as to for JAVA, at least for this kind of thing. One reason is that there are quite a few GUI toolkits, so development is kind of spread thin. If you really need the alpha blending and anti-aliasing, and matplotlib can't do what you want out of the box, I'd highly encourage you to work on a general purpose Agg module. It would be a real contribution to the community, and I'd integrate it into FloatCanvas, so you could get the rest of what you need from that. Another option would be to look at wrapping wxArt2d. -Chris -- 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 Chr...@no... |