Green Shoes でメモ帳を作る

やってみました。

require 'bundler/setup'
require 'green_shoes'

Shoes.app title: "Shoes Notepad", width: 600, height: 370 do
  ebox = nil
  text = ""
  read_text = "edit area"
  background papayawhip
  
  flow width: 1.0, height: 0.1 do
    button "読み込み", height: 1.0 do
      fname = ask_open_file
      ebox.text = File.read(fname) if fname
    end
    
    button "保存", height: 1.0 do
      fname = ask_save_file
      open(fname, "w") {|io| io.print(text)} if fname
    end
    
    button "クリア", height: 1.0 do  
      ebox.text = ""
    end
  end
  
  flow width: 1.0, height: 0.9 do
    ebox =
    edit_box width: 1.0, height: 1.0, font: "18px" do |e|
      text = e.text
    end
    ebox.text = read_text
  end
end

こんな感じ。