Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. def ask_for_file(question)
  2. dialog = Gtk::FileChooserDialog.new(question, nil,
  3. Gtk::FileChooser::ACTION_OPEN,
  4. "gnome-vfs",
  5. [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT],
  6. [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL]
  7. )
  8. if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
  9. file_name = dialog.filename.to_s
  10. return file_name
  11. else
  12. return nil
  13. end
  14. end
  15.  
  16. path = ask_for_file("Test?")
  17. sleep(5)
  18. puts "continue with #{path}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement