Advertisement
Guest User

Untitled

a guest
Jun 27th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. class FileChooser(Gtk.Window):
  2. def __init__ (self):
  3. dialog = Gtk.FileChooserDialog("Select File", self, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
  4. self.add_filters(dialog)
  5. response = dialog.run()
  6. global filename
  7. filename = dialog.get_filename()
  8.  
  9. if response == Gtk.ResponseType.OK:
  10. print "File Selected: " + filename
  11.  
  12. dialog.destroy()
  13.  
  14. def add_filters(self, dialog):
  15. filter_any = Gtk.FileFilter()
  16. filter_any.set_name("All Files")
  17. filter_any.add_pattern("*")
  18. dialog.add_filter(filter_any)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement