XRC and subclasses

hello everybody, I'm trying to use wx.lib.colourselect.ColourSelect
control
with XRC but without success. It looks like XRC can't find the module.
To see
what I'm trying to do, please replace in XmlResourceSubclass demo
program this
line:

<object class="wxStaticText" name="label1">

with this one:

<object class="wxBitmapButton
subclass="wx.lib.colourselect.ColourSelect" name="label1">

and import wx.lib.colourselect at the beginning of the file. Am I
forgetting
something or am I trying something which is not possible?

Marco

Marco,

hello everybody, I'm trying to use wx.lib.colourselect.ColourSelect
control
with XRC but without success. It looks like XRC can't find the module.
To see
what I'm trying to do, please replace in XmlResourceSubclass demo
program this
line:

<object class="wxStaticText" name="label1">

with this one:

<object class="wxBitmapButton
subclass="wx.lib.colourselect.ColourSelect" name="label1">

and import wx.lib.colourselect at the beginning of the file. Am I
forgetting
something or am I trying something which is not possible?

Marco

I think the process is documented on the wiki somewhere. For some
reason, I can't get the wiki to load at the moment, so I can't provide
a link. I've also seen it explained on the list, so you might check
the archives. In fact, I'm pretty sure Robin explained the process
within the last 2 weeks.

As I recall, it had something to do with 2-stage creation, which is
also on the wiki.

Hopefully my fuzzy memory will get you going.

- Mike

···

On Jun 7, 9:07 am, Marco Prosperi <marcoprosperi...@gmail.com> wrote:

Correct, the XRC subclass mechanism needs to use the 2-phase create
pattern. IOW, Marco will need to derive a new class from ColourSelect
which takes no parameters in the __init__ other than self, and which
creates the BitmapButton instance using PreBitmapButton. And then it
needs to have some way of doing the rest of the initialization after
XRC has created the GUI object. See the demo for an example.

Robin

···

On Jun 8, 6:12 am, Mike Driscoll <kyoso...@gmail.com> wrote:

As I recall, it had something to do with 2-stage creation,

Robin,

> As I recall, it had something to do with 2-stage creation,

Correct, the XRC subclass mechanism needs to use the 2-phase create
pattern. IOW, Marco will need to derive a new class from ColourSelect
which takes no parameters in the __init__ other than self, and which
creates the BitmapButton instance using PreBitmapButton. And then it
needs to have some way of doing the rest of the initialization after
XRC has created the GUI object. See the demo for an example.

Robin

Just for reference, which demo has that example in it? There are no
obvious XRC examples in the runnable demo, nor is there an obvious 2-
phase creation example. I'm pretty sure I've read the code you
mention, but that was a long time ago.

It might be a good idea to have an example that's specifically named
"2-phase creation of a widget" or something.

Mike

···

On Jun 8, 12:08 pm, Robin Dunn <ro...@alldunn.com> wrote:

On Jun 8, 6:12 am, Mike Driscoll <kyoso...@gmail.com> wrote:

XlmResourceSubclass.py

Robin

···

On Jun 8, 10:32 am, Mike Driscoll <kyoso...@gmail.com> wrote:

Just for reference, which demo has that example in it? There are no
obvious XRC examples in the runnable demo, nor is there an obvious 2-
phase creation example. I'm pretty sure I've read the code you
mention, but that was a long time ago.