將Perl\Tk改成Ruby\Tk
Perl\Tk版:http://www.wretch.cc/blog/cfcef&article_id=3586468
  require 'tk'
  tmptext=TkVariable.new
  def show(str)
    configure("text"=>str)
  end
  TkButton.new(){
    text "HI"
    command {proc show(tmptext.value)}
    pack("padx"=>5)
  }
  entry=TkEntry.new("textvariable"=>tmptext){
  pack("padx"=>10)
  }
  Tk.mainloop

hechian 發表在 痞客邦 留言(0) 人氣()