[pygtk] Re: Problem with simple custom widget
Jeffrey Barish
jeff_barish at earthlink.net
Sun Feb 17 08:33:38 WST 2008
Jeffrey Barish wrote:
> If I do give up, I wonder what is the right approach. Should I be
> subclassing a container? Can I subclass a Bin, have the subclass put an
> HBox in itself, and put the Label and Entry in the HBox? Or perhaps I
> should subclass HBox and have the subclass put the Label and Entry in
> itself. Or maybe I should just make a factory function that produces
> HBoxes with the right stuff inside. The last, no doubt, is easiest, but I
> was hoping to encapsulate interactions between the various widgets I will
> be dealing with.
I got a subclass to work by subclassing Container. And I think I understand
that the reason I failed to add a Label to an Entry by subclassing Entry is
that Entry is not a container, so it can't contain the Label. I conclude
that if I want to create custom widgets that are composites, I need to
start with a Container. And don't forget to set flag gtk.NO_WINDOW. I'd
be happy to post the subclass, but I can't tell whether anyone is actually
interested in my ramble.
--
Jeffrey Barish
More information about the pygtk
mailing list