Filechooser issues

Mr SZ sk8in_zombi at yahoo.com.au
Fri Jul 11 15:09:25 EDT 2008


Hi,
I am using a gtk.filechooser dialog to open and save files.How do I add a filter so that only images are filtered ?I did something like this:

    def get_save_filename(self):
    
        filename = None
        chooser = gtk.FileChooserDialog("Save File...", self.window,
                                        gtk.FILE_CHOOSER_ACTION_SAVE,
                                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, 
                                         gtk.STOCK_SAVE, gtk.RESPONSE_OK))
    ff = gtk.FileFilter.add_pixbuf_formats()
        chooser.add_filter(ff)
        response = chooser.run()
        if response == gtk.RESPONSE_OK: filename = chooser.get_filename()
        chooser.destroy()
        
        return filename

Now I get an error when I add ff or a filefilter .The error is :

Traceback (most recent call last):
  File "tutorial.py", line 91, in on_save_as_menu_item_activate
    filename = self.get_save_filename()
  File "tutorial.py", line 231, in get_save_filename
    ff = gtk.FileFilter.add_pixbuf_formats()
TypeError: descriptor 'add_pixbuf_formats' of 'gtk.FileFilter' object needs an argument

The documentation doesn't say anything about an argument to be passed:
http://www.pygtk.org/docs/pygtk/class-gtkfilefilter.html#method-gtkfilefilter--add-pixbuf-formats

Regards,
SZ

" life isn't heavy enough,it flies away and floats far above action"


      Start at the new Yahoo!7 for a better online experience. www.yahoo7.com.au
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080711/7cffddcf/attachment.html>


More information about the Python-list mailing list