Is it better to derive from Gtk.Widget or directly from a specific widget?
<p>When I create a UI class for my app, I often wonder if it's better to derive my class from <code>Gtk.Widget</code> and then add explicitly the widgets I need or to derive directly from a specific widget.</p>

<p>Here is two examples, which one is the best?</p>

<pre class="lang-py prettyprint-override"><code>class MyComponent(Gtk.Widget):
    def __init__(self):
        Gtk.Widget.__init__(self)

        box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 6)
        button1 = Gtk.Button.new_with_label("Awesome Button1")
        button2 = Gtk.Button.new_with_label("Awesome Button2")
        button3 = Gtk.Button.new_with_label("Awesome Button3")
        box.pack_start(button1, True, True, 0)
        box.pack_start(button2, True, True, 0)
        box.pack_start(button3, True, True, 0)

        self.add(box)
</code></pre>

<pre class="lang-py prettyprint-override"><code>class MyComponent(Gtk.Box):
    def __init__(self):
        Gtk.Box.__init__(self, Gtk.Orientation.HORIZONTAL, 6)

        button1 = Gtk.Button.new_with_label("Awesome Button1")
        button2 = Gtk.Button.new_with_label("Awesome Button2")
        button3 = Gtk.Button.new_with_label("Awesome Button3")
        self.pack_start(button1, True, True, 0)
        self.pack_start(button2, True, True, 0)
        self.pack_start(button3, True, True, 0)
</code></pre>

<p>It seems to me that the first version is better since my component isn't technically a <code>Gtk.Box</code>, it's a widget that is using a <code>Gtk.Box</code>, but it could as well use a <code>Gtk.Grid</code> or a <code>Gtk.DrawingArea</code>.</p>

<p>So it seems right on a design stand point, but maybe there's some technicalities that I don't see. What's your advice?</p>