[pygtk] Automatic actions and gtk.FileChooserButton

Neil Dugan pygtk at butterflystitches.com.au
Sat Apr 19 10:47:19 WST 2008


Marcus Vinicius Eiffle Duarte wrote:
> 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 start=
up,
> this FileChooserButton displays the default folder for the application, a=
nd
> 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 cla=
ss
> (as other functions that are executed by other signals of other widgets a=
nd
> called as self.<function_name>):
> =

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

> Can someone help me?

How about this example ?

> =

> Thanks in advance,
> =

> =


Regards Neil.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: filechooser.py
Type: text/x-python
Size: 1321 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20080419/d6bb24f7/f=
ilechooser.py


More information about the pygtk mailing list