On Mon, Jan 31, 2005 at 09:30:27AM +0100, Antonio Caputo wrote: > > On Sun, Jan 30, 2005 at 11:10:36AM +0100, Nemesis wrote: > > > I think that some methods like gtk.Image.set_from_file() should accept > > > as argument not only the filename as string but also a file object. > > > > I disagree. As it is, there is a fairly straightforward mapping > > between pygtk and the underlying GTK+ C API. gtk_image_set_from_file() > > takes a string that is a file name. Passing a file object is a major > > semantic difference, and it would not be possible to write a wrapper for > > gtk_image_set_from_file() from a file object, it would be a totally > > different function from its C counterpart. > > I don't want to break the API mapping. Maybe it is possible to add a > pygtk only method (If I remember correctly there are already such methods > for treeviews). I'm not sure which methods you have in mind. There are some pygtk only methods for low level details that clearly would be very awkward to emulate, but otherwise I think pygtk API additions are made rather conservatively.
> For example a gtk.Image.set_from_file_object() > > I think what you want can be done with a gtk.gdk.PixbufLoader or > > possibly one of the gtk.gdk.pixbuf_new_from constructors. Then you can > > use gtk.Image.set_from_pixbuf(). > > You are right, the solution is PixbufLoader it can take a buffer and > write it to a pixbuf. > Maybe the the gtk.Image.set_from_file_object() could be a wrapper for > this solution. Something like this: The question is whether it is worth modifying the pygtk API for this convenience that we've established can be done fairly concisely in python anyway. -jkl _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
