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.
gtk.Image.set_from_file, like most of the API functions are
autogenerated from the GTK+ type information data structures.

> 
> In this way should be possible to use file-like objects as StringIO,
> when for example you have an in Image represented in a string and you
> don't want to write it to a file and then read it again.

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().

This is pretty much analogous to what you would do with the API in other
language bindings.

 -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/

Reply via email to