|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
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> Thanks! Dan _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
|
|
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.) _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
|
|
Re: PYGTK: How can one add an argument to a callback?On 11/03/2009 10:35 AM, Lars Wirzenius wrote:
> 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.) > > > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@... > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > BTW: Assuming that you are the owner of this forum, I tried to register on your GTK+ Forum, but apparently, I was not able to obtain the email sent to me at the email provided and lost it due to email spam blocking. Is there anyway to resend the GTK+ Forum email so that I could proceed to log into the forum, since I have added the forum's email address to my email whitelist? Thanks again! Dan _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
|
|
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 _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
| Free embeddable forum powered by Nabble | Forum Help |