daily pastebin goal
63%
SHARE
TWEET

Untitled

a guest Jun 27th, 2012 23 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top