Re: PYGTK: How can one add an argument to a callback?




The following code:

[...]
tvc.set_cell_data_func(cp, self.on_file_pixbuf)
[...]
def on_file_pixbuf1(self, column, cell, model, iter):
    <code>
[...]

works fine, but what if I need to add another
argument to "self.on_file_pixbuf" without destroying
the arguments already supplied by the constructor?

For example, I want to do the following:

tvc.set_cell_data_func(cp, self.on_file_pixbuf1(t))

where 't' is another argument I wish to pass in
addition to that provided by the cell so that the
method results as:

def on_file_pixbuf1(self, column, cell, model, iter, t):
    <code>

Make the call like:

tvc.set_cell_data_func(cp, self.on_file_pixbuf, t)

for callback like:

def on_file_pixbuf1(self, column, cell, model, iter, t):

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]