On 5/4/05, Richard Taylor <[EMAIL PROTECTED]> wrote:
> On Wednesday 04 May 2005 11:33, Nikos Kouremenos wrote:
> > On 5/4/05, Richard Taylor <[EMAIL PROTECTED]> wrote:
> > > Hi
> > >
> > > I would like to put a Button in a ListView Cell. Am I correct that I need
> > > to subclass GtkCellRenderer to do this?
> > >
> > > If I do need to subclass GtkCellRenderer are there any pygtk examples of
> > > how to do it?
> >
> > have a look
> > http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq13.041.htp
>
> Thanks for the link. That gets me some of the way there. All I need to
> understand now is how to render a GtkButton in the on_render method. Hmm, I
> am not sure where to start ...
in Gajim we have done it this way:
def on_roster_treeview_button_press_event(self, widget, event):
if event.button == 1: # Left click
try:
path, column, x, y =
self.tree.get_path_at_pos(int(event.x),
int(event.y))
except TypeError:
self.tree.get_selection().unselect_all()
return False
model = self.tree.get_model()
iter = model.get_iter(path)
type = model.get_value(iter, 2)
if x < 20: # first cell in 1st column
if (self.tree.row_expanded(path)):
self.tree.collapse_row(path)
else:
self.tree.expand_row(path,
False)
of course that is a 'hack' that requires that you either have the
width of the cell static or known
if it's a better way I would like to read it :)
--
Nikos Kouremenos | Jabber ID: [EMAIL PROTECTED] | http://members.hellug.gr/nkour
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/