I'm using Glade and PyGtk to develop an application. Currently I'm using a button under a toolbar to open files using this code:
def on_openVideo_clicked(self, widget): dialog = Gtk.FileChooserDialog("Please choose a video", self, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK)) self.add_vfilters(dialog) dialog.set_current_folder('/home') response = dialog.run() if response == Gtk.ResponseType.OK: self.videoInput = dialog.get_preview_filename() print "Video file Choosen: ", self.videoInput elif response == Gtk.ResponseType.CANCEL: print 'Cancel Clicked' dialog.destroy()
But I decided to replace it with a FileChooserButton because it has better visualization. But I don't know how to print the file name. I guessed it should be something like this:
def on_filechooserbutton_file_set(self, widget): print widget.get_filename()
But this doesn't work. So my question is how to retrieve filename from filechooserbutton?