[pygtk] Automatic actions and gtk.FileChooserButton

Marcus Vinicius Eiffle Duarte eiffleduarte at gmail.com
Wed Apr 16 22:14:35 WST 2008

Hi, folks!

Sorry if this question seems silly, but I am rather new to python and a
total newbie regarding Gtk programming, I googled a lot for a solution to my
problem and couldn't find something that worked for me.

I created a GUI using Glade, which contains a FileChooserButton. On startup,
this FileChooserButton displays the default folder for the application, and
a list of text files contained in this folder is loaded and presented in a
TreeView. My idea is, everytime the user chooses another folder using the
FileChooserButton, the application automatically loads the list of text
files in this new folder and refreshes the TreeView to show this new list.

In order to do this, I connected some code to the "current_folder_changed"
signal of the FileChooserButton, as in

        self.btnPasta =3D self.wTree.get_widget( "btnPasta" )
        self.btnPasta.connect( "current_folder_changed", self.mudarPasta )

However, when I use the FileChooserButton btnPasta to choose another
folder,nothing happens. I made some tests and it seems that the function
mudarPasta is not executed at all. This function is defined inside my class
(as other functions that are executed by other signals of other widgets and
called as self.<function_name>):

    def mudarPasta( filechooser, widget ):
        novaPasta =3D filechooser.get_current_folder()
        PASTA =3D novaPasta
        os.chdir( PASTA )

Can someone help me?

Thanks in advance,
-- =

Marcus Vinicius Eiffle Duarte
eiffleduarte at gmail.com
Niter=F3i, RJ, Brasil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20080416/21802371/at=

More information about the pygtk mailing list