From: Mathew Cucuzella Date: 2010-06-08T01:33:41+09:00 Subject: Re: using TkEntry with copy/paste Hidetoshi NAGAI wrote: > How about the following > > > require 'tk' > top = TkRoot.new > var = TkVariable.new > entry = TkEntry.new(top, :state=>'readonly', > :textvariable=>var).grid(:row=>0, :column=>0) > TkButton.new(top, :text=>'Convert', > :command=>proc{var.value = 'hi'}).grid(:row=>1, > :column=>0) > > Tk.mainloop > Thanks, that will work. I tried what I thought was the equivalent (below) but it didn't work. The only real difference was that I didn't pass my config params as function arguments. require 'tk' top = TkRoot.new # variable used in entry field, written with button press text_var = TkVariable.new entry = TkEntry.new(top) {textvariable = text_var; grid('row'=>0, 'column'=>0)} TkButton.new(top) {text 'Convert'; grid('row'=>1, 'column'=>0); command proc { # the next line does not show the string in the TkEntry text_var.value = "using variable" } } -- Posted via http://www.ruby-forum.com/.