redrawing to a device context in wxPython

Tom Babbitt tbabbitt at commspeed.net
Sun Jan 27 00:56:00 EST 2002


"Duncan Smith" <buzzard at urubu.freeserve.co.uk> wrote in message
news:a2vuse$eh3$1 at news8.svr.pol.co.uk...
> I am drawing graphs (nodes and edges) to a wxPanel.  But I want to redraw
> local parts of the graph structure to reflect the changes made to the
graph
> by an algorithm running in the background.  Obviously I want this to be as
> efficient as possible, and I'd rather not redraw the whole graph on each
> iteration of the algorithm.  Is it a question of redrawing the parts I
want
> to get rid of in the background colour of the panel, or is there a 'cuter'
> way of doing this?
>
> Any advice on how to go about laying out graphs would also be appreciated.
> I sometimes have the structure but no coordinates for the nodes.  So I
could
> do with an algorithm for setting it out in a pleasing (to the eye) way.
> (For the most part the graphs will be directed and acyclic.)  Thanks in
> advance.
>
> Duncan
>
>
you can set the clipping region of the DC

wxDC::SetClippingRegion
void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)

void SetClippingRegion(const wxRegion& region)

Sets the clipping region for the DC. The clipping region is an area to which
drawing is restricted. Possible uses for the clipping region are for
clipping text or for speeding up window redraws when only a known area of
the screen is damaged.

See also

wxDC::DestroyClippingRegion, wxRegion

have a look at http://www.linmpi.mpg.de/dislin/ and
http://mayavi.sourceforge.net/screenshots/index.html
for data visualization

Tom Babbitt





More information about the Python-list mailing list