Skip to content

Instantly share code, notes, and snippets.

@dysinger
Created September 4, 2008 04:59
Show Gist options
  • Save dysinger/8722 to your computer and use it in GitHub Desktop.
Save dysinger/8722 to your computer and use it in GitHub Desktop.
A simple shoes app to get my son started
#!/usr/bin/env ruby
# -*- ruby -*-
Shoes.app(:title => "Mommy Bucks Calculator",
:width => 300, :height => 400, :resizable => false) do
background "rgb(240, 245, 220)"
stack do
stack(:margin => 10) do
para("Current Mommy Bucks")
@bucks = edit_line
end
stack(:margin => 10) do
para("Spending US Dollars")
@spend = edit_line
end
stack(:margin => 10) do
para("Mommy Bucks Left")
@left = para
end
stack(:margin => 10) do
button("Calculate") do
mommy_bucks_i_have_now = @bucks.text.to_i
spend_in_mommy_bucks = @spend.text.to_i * 10
left_over_mommy_bucks = mommy_bucks_i_have_now - spend_in_mommy_bucks
@left.text = left_over_mommy_bucks
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment