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



On Tue, 2009-11-03 at 09:46 -0800, Daniel B. Thurman wrote:
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>

You can create a new function:

        t = something
        
        def helper(column, cell, model, iter):
            self.on_file_pixbuf1(column, cell, model, iter, t)
        
        tvc.set_cell_data_func(cp, helper)

(Untested code, but you should get the idea.)





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