Sha256: e230f6e41d7c7058935e486c5f9f5d4973f4ae436bb01b448d09243f2e5f8808
Contents?: true
Size: 460 Bytes
Versions: 9
Compression:
Stored size: 460 Bytes
Contents
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>'){ 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.mainloop
Version data entries
9 entries across 9 versions & 1 rubygems