example/choose_directory.rb in ffi-tk-2010.08.23 vs example/choose_directory.rb in ffi-tk-2018.02.20

- old
+ new

@@ -1,22 +1,23 @@ +# frozen_string_literal: true require 'ffi-tk' Tk.init label = Tk::Label.new(Tk.root, text: 'Press any key to open the dialog') label.pack -Tk.root.bind('<Key>'){ +Tk.root.bind('<Key>') do dir = Tk.choose_directory(initialdir: '~', title: 'Choose a directory') label.configure text: 'Press any key to close the window' if dir Tk::Label.new(Tk.root, text: "Selected #{dir}").pack else Tk::Label.new(Tk.root, text: 'No directory selected').pack end - Tk.root.bind('<Key>'){ exit } -} + Tk.root.bind('<Key>') { exit } +end -Tk.mainloop \ No newline at end of file +Tk.mainloop