On Mon, 2005-05-23 at 16:30 +0200, A.T.Hofkamp wrote: > Ross Burton wrote: > > On Mon, 2005-05-23 at 10:27 +0200, A.T.Hofkamp wrote: > > > >>It is probably my Qt background that steered me in the wrong direction. > >>There, > >>a base class Widget is used to derive new widgets. I was looking for > >>something > >>similar but could not find it. Also, the tutorial didn't show how to do > >>this. > > > > > > The base UI object in PyGTK is gtk.Widget... > > I tried that one too, but like 'Container', Widget is an abstract > (non-instantiable) class, so it is of very little use in pygtk. > (not sure whether that should be considered a problem though, at first sight > it seems not, at least for application programming).
In PyGTK 2.6, you can subclass Widget and Container, as long as you gobject.type_register(MyClass). After registration, you can start creating instances, but not before. But it's better to subclass an existing container, otherwise you have to reimplement the GtkContainer protocol methods. > > > I am quite happy with the use of a concrete container class as base for my > Gantt chart widget. It seems like a sensible solution to me. If only I had > discovered this before the weekend instead of after it.... :-) > > The Qt solution has the advantage that I can start rendering graphics > directly > in the derived class by overriding paintEvent() . On the other hand, pygtk > has > the advantage that there is a clear seperation between containers and > drawables. If you want drawing, you should use gtk.DrawingArea, and connect a handler to 'expose-event' signal. You can paint in that handler. Although you're probably better off (read, your program paints faster) just using a widget like gnomecanvas.Canvas... Regards. > > > > Albert > > _______________________________________________ > pygtk mailing list [email protected] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ -- Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> The universe is always one step beyond logic.
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
