[pygtk] Drawing widgets in a custom cellrenderer
F Wolff
friedel at translate.org.za
Fri Dec 7 19:03:33 WST 2007
Thanks for your reply, Johan. I'll try to clarify my question more
below...
Op Vrydag 2007-12-07 skryf Johan Dahlin:
> F Wolff wrote:
> > Hi list.
...
> >
> > (by the way, why isn't the gtk.Widget.draw() method documented?)
>
> Because it is deprecated and should not be used.
> Use self.widget.window.draw_rectangle() instead.
I see. I don't find .draw_rectangle() anywhere, though. The issue is
that I want the widget (a container) to draw itself (and all its
children) normally, but I'm guessing I need to pass the widget it needs
to draw on, etc.
>
> > I guess another issue is that my self.widget isn't added to some parent
> > anywhere, but I don't see where/how it could/should be done (somewhere
> > in the treeview?).
>
> I'm not sure what you're trying to do is actually going to work since I
> haven't actually tried this myself.
>
> However, if you need to access the parent for whatever reason you need
> to add a property just like the FAQ entry 3.45 does, and when you add
> the cellrenderer to the treeview column you need to set an extra attribute.
> Attributes is a way to map cell renderer properties to a treeview column.
The reason I mention the parent is just that I assume that the
self.widget I create has to be a child of some widget in order to be
realised, and the cellrenderer where I instantiate it is not a
gtk.Widget. gtk.CellRendererText displays something like a gtk.Label
(when not editing a cell), so I would like to do something like that -
just with any widget of my liking. I've worked out how to plug in my own
widget for the editing mode (with do_start_editing), but I don't see how
to do that for the default mode.
Thanks for any help.
Friedel
More information about the pygtk
mailing list