[pygtk] How to use gtk.FileChooserButton?

Taras naplanetu at gmail.com
Mon Aug 13 19:51:18 WST 2007


Hello, everybody!
Now I currently use such code with usual button for run and process
response  file chooser dialog.
Some times ago I found in PyGTK reference new gtk.FileChooserButton (
http://pygtk.org/docs/pygtk/class-gtkfilechooserbutton.html)
but from manual I didn't understand how to use it.
Can you give me some example of it?

# ...

fileselButton =3D gtk.Button("Browse")
fileselButton.connect("clicked", self.open_file_dialog)

# ...

        def open_file_dialog(self, widget):
                self.chooser =3D gtk.FileChooserDialog(title=3DNone,action=
=3D
gtk.FILE_CHOOSER_ACTION_OPEN,
                                buttons=3D(gtk.STOCK_CANCEL,
gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
                self.chooser.set_current_folder(os.environ['HOME'])
                self.chooser.set_default_response(gtk.RESPONSE_OK)
                response =3D self.chooser.run()

                if response =3D=3D gtk.RESPONSE_OK:
                     # some actions
                self.chooser.destroy()

-- =

Thanks, Taras
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20070813/a9173138/at=
tachment.htm


More information about the pygtk mailing list