Problems With ColourSelect Box Inside A wxDialog
reqhye72zux at mailexpire.com
Wed Oct 10 01:44:32 CEST 2001
William Wonneberger wrote:
> I'm trying to add a wxPython ColourSelect control to a wxDialog box
> inside a Python script I've been working on. To instantiate the
> ColourSelect control, I've added the following statement to my
> Python script;
> self.colorselect = ColourSelect(self, wxPoint(70, 200), [0, 0,
> 110], wxDefaultSize)
That isn't much context to work on. There are a number of "psychic
debuggers" in this ng, but I'm not one of them.
> Am I instantiating the ColourSelect control correctly?
No, it should be:
self.colorselect = ColourSelect(self, -1, [0, 0, 110],
wxPoint(70, 200), wxDefaultSize)
(And you might as well lose the wxDefaultSize, as that's the default
parameter in cases like this.[*] The -1 can be replaced by an explicit
ID value, if the need ever arises.)
I'm amazed you see a memory leak warning, but no error message from
Python itself. I often noticed memory leak warnings after a stack
trace. This hardly ever crashes wxPython, but does seem to interfere
with properly disposing some of the objects that have been created.
Once you fix the error the leak will disappear.
> Am I missing an additional statement to enable or make visible the
> ColourSelect dialog box?
No, It's actually just a wxButton type control, but the caption has
been replaced by a colour.
[*] If you use sizers, you gan get rid of the initial position, too.
Using sizers in dialogs is a bit more critical in dialogs than in
normal wxFrames/Windows/Panels, though.
More information about the Python-list