[pygtk] Writing a composite widget
Frédéric
frederic.mantegazza at gbiloba.org
Wed Oct 8 15:27:08 WST 2008
Le 8/10/2008, "Darren Hart" <darren at dvhart.com> a écrit:
>I'm looking to write a custom widget which I call a StackedTreeView.
>It's basically a TreeView with multiple models, each one having a
>button to update the view to use its model. I'd build this out of
>individual widgets by making an hbox with one cell for the view and
>one cell per model for the buttons. When the user presses a button
>the treeview is moved to the cell just below the button pressed and is
>assigned the button's corresponding model.
>
>So, does it make sense to just write a Mediator that wrapps an hbox
>with all these things, or does it make sense to write my own widget.
>If I were to write my own widget, do I derive from TreeView? If so,
>how do I add buttons, and what handles the packing?
>
>Is there some best-practices document or something regarding creating
>composite widgets with gtk?
I think it will be a lot easier to write a Mediator, as it won't need
you to do complex things at GTK level. And it will be easier to adapt if
you want to switch to another toolkit.
In another hand, it is very interesting to understand low-level mecanisms
of a toolkit ;o)
--
Frédéric
More information about the pygtk
mailing list