[wxPython-users] Clearing a wx.lib.scrolledpanel.ScrolledPanel
Robin Dunn
robin at alldunn.com
Mon Dec 31 15:46:40 PST 2007
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!
More information about the wxpython-users
mailing list