Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FileChooser(Gtk.Window):
- def __init__ (self):
- dialog = Gtk.FileChooserDialog("Select File", self, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
- self.add_filters(dialog)
- response = dialog.run()
- global filename
- filename = dialog.get_filename()
- if response == Gtk.ResponseType.OK:
- print "File Selected: " + filename
- dialog.destroy()
- def add_filters(self, dialog):
- filter_any = Gtk.FileFilter()
- filter_any.set_name("All Files")
- filter_any.add_pattern("*")
- dialog.add_filter(filter_any)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement