[pygtk] Automatic actions and gtk.FileChooserButton

Marcus Vinicius Eiffle Duarte eiffleduarte at gmail.com
Tue Apr 29 04:05:24 WST 2008


Neil,

your example uses the FileChooserDialog widget, not the FileChooserButton
widget. My problem is that I couldn't find the proper methods of the
FileChooserButton widget.
Then I finally realized two things:
1) as gtk.FileChooserButton implements a button to call a
gtk.FileChooserDialog and gtk.FileChooserDialog itself implements an
interface to gtk.FileChooser, I should be able to invoke all gtk.FileChooser
methods from a FileChooserButton; and
2) in my previous declaration of the function "mudarPasta" I was making the
mistake of confusing the argument mudarPasta receives. The first argument it
receives is self, an instance of the class where my FileChooserButton is
instatiated, and the SECOND argument is the FileChooserButton originating
the callback. So, I have to call the right object, as in the following code

    def mudarPasta( self, widget ):
        novaPasta =3D widget.get_current_folder() # before I was doing the
mistake of trying to run novaPasta =3D self.get_current_folder()
        print novaPasta
        PASTA =3D novaPasta
        os.chdir( PASTA )
        self.popular()

Now it works great.

Thnaks,

Marcus Vinicius Eiffle Duarte
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20080428/187255f6/at=
tachment.htm


More information about the pygtk mailing list