Hello, I am trying to use a Python script gtk under Python 2.7.3; On Linux (under X11) and discs, images need to be loaded in pixbuffs.
However, Python gives a glib.GError: try to open the "Could not recognize the image file format"; Eg: with: pixbuf = gtk.gdk.pixbuf_new_from_file (filename)
I do I load a can gtk.gdk.pixbuf_get_formats () I, and the format, which went returned List Attempt is listed. PNG, PPM, .jpg.
When I tried gtk.gdk.pixbuf_get_file_info (filename) do, however, it does not give any returns.
Other GTK-based programs such as GIMP, load these images properly; And gtk scripts that do not load icons from disk, but pull buttons - etc. Just work fine.
How do I find out the reasons for this problem?
Am I missing some type of mime-type file?
Is there an alternative path to use other GTK function calls which could be another way to load?
This works for me:
#! / Usr / bin / env python # - * - coding: UTF -8 - * - import gtk def win_with_image (): pixbuf = gtk.gdk.pixbuf_new_from_file ( "photo.png") print Piksif win = gtk.Window (gtk. WINDOW_TOPLEVEL) image = gtk.Image () image.set_from_pixbuf (pixbuf) win.add (image) win.connect ( "destroy", gtk.main_quit) win.show_all () that __name__ == '__main__': win_with_image () gtk If it is not - Start Google and type your error and choose another link (), normally it's always Always helps to
- Restore Dubai
- Install gtk (probably some gra
- Correct the broken package repository
- Change file permissions < / Li>
-
-
No comments:
Post a Comment