[wxPython-users] Re: ogl, how to erase a shape ?

Matthieu Brucher matthieu.brucher at gmail.com
Mon Jun 25 11:14:32 PDT 2007


Sorry, I thought about Refresh() not Redraw() :| (on one of the parent of
the diagram or the diagram itself, I think)

Matthieu

2007/6/25, Stef Mientki <s.mientki at ru.nl>:
>
> Simon and Matthieu thanks for your answers,
> but it still is quit a problem for me:
>
> I tried this code,
> which indeed removes it from the diagram, beccuse I can't drag and drop
> the ogl shape anymore,
> but nothing is repainted, so the image is still there.
> I tested both Redraw of  the container (descendant of ShapeCanvas, taken
> from the wxPython demo),
> and Redraw of the diagram and in several combinations of them,
> nothing seems to get rid of that old image :-(
>       LED.shape.Show(False)
>       self.Shape_Container.diagram.RemoveShape(LED.shape)
>       dc =3D wx.ClientDC ( self.Shape_Container )
>       self.Shape_Container.PrepareDC ( dc )
>       self.Shape_Container.diagram.Redraw (dc)
>       self.Shape_Container.Redraw (dc)
>
>
> I also tried this, without success
>
>       LED.shape.Show(False)
>       dc =3D wx.ClientDC ( self.Shape_Container )
>       self.Shape_Container.PrepareDC ( dc )
>       self.Shape_Container.Redraw (dc)
>
>       LED.shape.SetX(LED.shape.GetX()+20)
>       LED.shape.Show(True)
>       dc =3D wx.ClientDC ( self.Shape_Container )
>       self.Shape_Container.PrepareDC ( dc )
>       self.Shape_Container.Redraw (dc)
>
> Any other ideas,
> or maybe someone has an example ?
>
> cheers,
> Stef
>
>
> simon kagwe wrote:
> > Stef Mientki <S.Mientki <at> ru.nl> writes:
> >
> >
> >> hello,
> >>
> >> my second question in moving a ogl-shape,
> >> "how to remove the old shape, after the new shape is drawn ?"
> >> was lost in the other weird problems.
> >>
> >> thanks,
> >> Stef Mientki
> >>
> >> Kamer van Koophandel - handelsregister 41055629  / Netherlands Chamber
> of
> >>
> > Commerce - trade register 41055629
> >
> > Hi,
> >
> > For erasing shapes, your diagram (the one you specified in SetDiagram)
> has a
> > RemoveShape method. You have to make sure you redraw the canvas every
> time you
> > make such changes as erasing, adding and moving shapes. Therefore, your
> code
> > will have something like this:
> >
> > dc =3D wx.ClientDC(self)
> > self.PrepareDC(dc)
> > ....
> > shape.Show(False)
> > self.diagram.RemoveShape(shape)
> > self.canvas.Redraw(dc)# i think its the same as self.diagram.Redraw()
> >
> > To clear the whole canvas, use <your canvas>.Clear(dc)
> >
> > I hope that helps.
> >
> > Regards,
> > Simon
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> > For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200706=
25/e248f713/attachment.htm


More information about the wxpython-users mailing list