Best way to ensure a button overlaps another

I have the following code to achieve a paint-type program's background/foreground colours buttons. I've also attached a screenshot, showing how it looks.
I've coded this so that on Windows the background colour (the smaller button)'s parent is the foreground button. On GTK, using the panel as the parent works.

However, on Windows, I've noticed that sometimes the background button will disappear behind the foreground one. Clicking on its area will active its event and trigger the change_background method, and bring it back into display. Is this the best way to make them overlap? It's a bit ugly with all the absolute positioning

I can't seem to find out *when* this behaviour happens, I'll just notice the button is "wrong"

        panel = wx.Panel(self.pane)
        self.colour = csel.ColourSelect(panel, pos=(0, 0), size=(60, 60)) # big button
        parent = panel
        if os.name == "nt":
            parent = self.colour # segfaults otherwise

        sizer = wx.BoxSizer()
        swap_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.background = csel.ColourSelect(parent, pos=(0, 30), size=(30, 30)) # smaller button, left-side corner
        self.transparent = wx.CheckBox(panel, label=_("Transparent"), pos=(0, 69))
        #icon = wx.Bitmap("something.png")

        #swap = wx.BitmapButton(panel, bitmap=icon, pos=(70, 0),
                                     style=wx.NO_BORDER)

        self.colour.Bind(csel.EVT_COLOURSELECT, self.change_colour)
        self.background.Bind(csel.EVT_COLOURSELECT, self.change_background)
        self.transparent.Bind(wx.EVT_CHECKBOX, self.on_transparency)
        swap.Bind(wx.EVT_BUTTON, self.on_swap)

        sizer.Add(self.background)
        sizer.Add(self.colour)
        sizer.Add(self.transparent)
        swap_sizer.Add(sizer)
        swap_sizer.Add(swap, flag=wx.ALIGN_RIGHT)

···

--
Steven Sproat, BSc
http://www.basicrpg.com/

Unfortunately wx does not support overlapping controls. At best when you do overlap them the behavior is "undefined". What you'll probably want to do instead is to create a custom widget that takes care of both the foreground and background colors with a single widget.

···

On 1/12/10 6:34 PM, Steven Sproat wrote:

I have the following code to achieve a paint-type program's
background/foreground colours buttons. I've also attached a screenshot,
showing how it looks.
I've coded this so that on Windows the background colour (the smaller
button)'s parent is the foreground button. On GTK, using the panel as
the parent works.

However, on Windows, I've noticed that sometimes the background button
will disappear behind the foreground one. Clicking on its area will
active its event and trigger the change_background method, and bring it
back into display. Is this the best way to make them overlap? It's a bit
ugly with all the absolute positioning

--
Robin Dunn
Software Craftsman