[pygtk] Filechooserbutton callback

John Finlay finlay at moeraki.com
Wed Oct 22 16:51:40 WST 2008


Frédéric wrote:
> Hello,
>
> I added a Filechooserbutton in my GUI (using glade-3). When I clik on the
> button, it opens the file dialog, and I can choose a file.
>
> But how can I be notified that the user has used that button? What signal
> to bind, so I can retreive what was the user action (Accept/Cancel), and
> the file he chosed?
>   
AFAICT the FileChooserButton is a replacement for using an entry/label 
and associated file browser button. It only allows selecting one 
existing file or folder and displays the name of the selected file in 
the button label. The most likely application is to use the FCB in a 
dialog where a file or folder is to be selected (along with other info) 
and finally another action (e.g. clicking an OK button) is used to 
retrieve the currently selected file or folder and perform some 
operations. I don't think it works very well if you want to perform some 
actions immediately after selecting a file or folder unless you pass in 
a FileChooserDialog and add the buttons and handle its responses and 
signals. You can use the "selection-changed" signal with the FCB to be 
notified when a different file has been selected and the dialog is closed.

John


More information about the pygtk mailing list