[pygtk] new widget which encapsulate other widgets

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Mon Sep 19 23:10:10 WST 2005


On Mon, 2005-09-19 at 15:44 +0200, Alessandro Ferrarin wrote:
> I'm trying to create a new pygtk widget which should encapsulate some
> other ones. Then it should be encapsulated by another one, and so on.
> 
> Suppose I want a widget that is composed by a label with a button.
> 
> class NewWidget(XXX):
>   def __init__(self, name):
>     XXX.__init__(self)
>     label = gtk.Label(name)
>     button = gtk.Button('first')
> 
> Now, I need a container to which append the label and the button!
> But XXX should be a gtk.Widget? Or a gtk.Container? Or what?
> 
> Anyone have a good code example or suggestions?

  http://telecom.inescporto.pt/~gjc/higcontainer.py

  Caveat: needs pygtk 2.8

> 
> Thank you very mutch for your attention.
> 
-- 
Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic.



More information about the pygtk mailing list