[wxPython] ColourSelect and Sizer.AddWindow()

hi,

i want to implement the ColourSelect - Button but there is a prob.
if i want to add the control to a sizer i receive the message
that ChooseButton is no _wxWindow_p_. With sizer.Add (which i use
the first time now, for what is this??) there is no method _this_.

hmmmmm, why i can't add the button?

Thatz my code:
    item1 = wxBoxSizer (wxVERTICAL)
    ChooseButton = ColourSelect(parent, wxDefaultPosition, [255,255,0], wxSize(100,30))

item1.AddWindow( ChooseButton, 0, wxALIGN_CENTRE|wxALL, 10 )

Some Ideas?

thx, reen

···

----
Rene Freund nur ein toter bug ist ein guter bug
rene@meder.de

i want to implement the ColourSelect - Button but there is a prob.
if i want to add the control to a sizer i receive the message
that ChooseButton is no _wxWindow_p_. With sizer.Add (which i use
the first time now, for what is this??) there is no method _this_.

hmmmmm, why i can't add the button?

Because ColourSelect doesn't derive from wxButton (or any other window type)
for some reason. Lorne was there a reason for this? If not then the
following will be the new ColourSelect class in the next release.

class ColourSelect(wxButton):
    def __init__(self, parent, id, bcolour=(0, 0, 0), pos=wxDefaultPosition,
size=wxDefaultSize):
        wxButton.__init__(self, parent, id, "", pos=pos, size=size)
        EVT_BUTTON(parent, self.GetId(), self.OnClick)
        self.SetForegroundColour(wxWHITE)
        self.SetColour(bcolour)

    def SetColour(self, bcolour):
        self.set_colour_val = set_colour = wxColor(bcolour[0], bcolour[1],
bcolour[2])
        self.SetBackgroundColour(set_colour)
        self.set_colour = bcolour

    def GetColour(self):
        return self.set_colour

    def OnClick(self, event):
        data = wxColourData()
        data.SetChooseFull(true)
        data.SetColour(self.set_colour_val)
        dlg = wxColourDialog(self.GetParent(), data)
        if dlg.ShowModal() == wxID_OK:
            data = dlg.GetColourData()
            self.SetColour(data.GetColour().Get())
        dlg.Destroy()