PDA

View Full Version : [SOLVED] pygtk - directory chooser dialog???



giuspen
November 11th, 2008, 07:26 PM
at this link
http://www.pygtk.org/pygtk2tutorial/sec-FileChoosers.html
it's very well described how to implement a file chooser dialog.
i expected that there would be an option to select a folder instead than a file, like with zenity, but i found nothing.
anybody can help me to make a directory chooser dialog in pygtk?
(i already made it through zenity and the subprocess module but i would like to use pygtk)

unutbu
November 11th, 2008, 09:27 PM
The gtk.FileSelection widget does what you need. See
http://www.pygtk.org/pygtk2tutorial/sec-FileSelections.html#fileselfig

Flimm
November 11th, 2008, 10:33 PM
Here's the option you're looking for:

chooser.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_ FOLDER)
Never forget the documentation, here's the reference for FileChooser (http://www.pygtk.org/docs/pygtk/class-gtkfilechooser.html#method-gtkfilechooser--set-action).

giuspen
November 12th, 2008, 08:31 AM
thanks a lot! :KS
giuseppe.

RockDoctor
December 4th, 2009, 01:10 AM
Here's the option you're looking for:

chooser.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_ FOLDER)Never forget the documentation, here's the reference for FileChooser (http://www.pygtk.org/docs/pygtk/class-gtkfilechooser.html#method-gtkfilechooser--set-action).

Thank you. Just what I need, even if it is a year old! :D

macabro22
July 17th, 2011, 07:26 AM
Cool! Just what I needed even if its n years old. Thanks a bunch!