transparent background for a panel widget

Stephen Hansen wrote:

    I've tried doing this by again setting BG_STYLE_CUSTOM and in the
    "OnPaint" handler doing something like this:

    dc.SetBackground(wx.TRANSPARENT_BRUSH)

I think you just aren't actually drawing it, and you need to do:

   dc.SetBrush(wx.TRANSPARENT_BRUSH)
   dc.SetPen(wx.TRANSPARENT_PEN)
   w, h = self.GetSizeTuple()
   dc.DrawRectangle(0, 0, w, h)

Hmm, I thought

dc.Clear()

should paint the whole widget with the background brush... at least that's what I was trying. I'll try your suggestion and let you know how it goes.

Thanks Stephen.

···

That'll draw a "Transparent" box over the whole size of the control.

Just calling 'SetBackground' sets what the background brush would be-- but doesn't /do/ anything. You're responsible (i've recently learned-- thanks Robin) for drawing the full bounds of your control. You just didn't actually paint it on.

--Stephen