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

Stef Mientki s.mientki at ru.nl
Mon Jun 25 11:01:17 PDT 2007


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 = 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 = 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 = 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 = 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
>
>
>
>   




More information about the wxpython-users mailing list