Clearing a wx.lib.scrolledpanel.ScrolledPanel

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Clearing a wx.lib.scrolledpanel.ScrolledPanel

Donn Ingle
Hi,
 I have a wx.lib.scrolledpanel.ScrolledPanel onto which I am drawing
(vertically) many wx.lib.statbmp.GenStaticBitmap objects.

I am seeing weird "leftovers" from what has gone before and am trying to
erase the background - the ScrolledPanel - well at least that's what I
think I should be trying to do.

The GenStaticBitmaps are made in a loop and destroyed before a new list of
them is made - I am 99% sure of this. So, it's not my dc drawing code
that's leaving stuff behind. (kind of xorish looking stuff)

I have tried this, as of a minute ago, to clear the backdrop:

In the class __init__:
self.Bind(wx.EVT_PAINT,  self.__onPaint)

With this method:
    def __onPaint(self, event):
        dc = wx.PaintDC(self)
        dc.SetBackground(wx.Brush("RED",wx.SOLID))
        dc.Clear()        
        return

What I see is that it does paint RED but only from the last Y position of
the last drawn bitmap.

I have been crawling up and down the object tree and I'm going slightly
mad - any tips?

\d


Reply | Threaded
Open this post in threaded view
|

Re: Clearing a wx.lib.scrolledpanel.ScrolledPanel

Robin Dunn
Donn Ingle wrote:

> Hi,
>  I have a wx.lib.scrolledpanel.ScrolledPanel onto which I am drawing
> (vertically) many wx.lib.statbmp.GenStaticBitmap objects.
>
> I am seeing weird "leftovers" from what has gone before and am trying to
> erase the background - the ScrolledPanel - well at least that's what I
> think I should be trying to do.
>
> The GenStaticBitmaps are made in a loop and destroyed before a new list of
> them is made - I am 99% sure of this. So, it's not my dc drawing code
> that's leaving stuff behind. (kind of xorish looking stuff)
>
> I have tried this, as of a minute ago, to clear the backdrop:
>
> In the class __init__:
> self.Bind(wx.EVT_PAINT,  self.__onPaint)
>
> With this method:
>     def __onPaint(self, event):
>         dc = wx.PaintDC(self)
>         dc.SetBackground(wx.Brush("RED",wx.SOLID))
>         dc.Clear()        
>         return
>
> What I see is that it does paint RED but only from the last Y position of
> the last drawn bitmap.
>
> I have been crawling up and down the object tree and I'm going slightly
> mad - any tips?

Make sure of the 1% too, because it sounds to me like the static bitmap
widgets still exist.  Try using the widget browser to see what is there
at runtime.

BTW, with your paint event above you will not be drawing over any child
widgets that may be on the panel, as they are automatically being
clipped out of their parent's paint event if they still exist.

--
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!


Reply | Threaded
Open this post in threaded view
|

Re: Clearing a wx.lib.scrolledpanel.ScrolledPanel

Donn Ingle
> widgets still exist.  Try using the widget browser to see what is there
> at runtime.
Widget browser? Sounds interesting, first time I've heard of it. I'll go
search around and see.

Thanks.
\d


Reply | Threaded
Open this post in threaded view
|

Re: Clearing a wx.lib.scrolledpanel.ScrolledPanel

Donn Ingle
In reply to this post by Robin Dunn
Robin, thanks for this advice:
> Make sure of the 1% too, because it sounds to me like the static bitmap
> widgets still exist.  Try using the widget browser to see what is there
> at runtime.
I found that 1% and it was my own bug - that widget browser is something
sweet :)

Once again, ye hath saved my bacon.

\d