Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/samples/simple-timer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'samples/simple-timer.rb')
-rw-r--r--samples/simple-timer.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/samples/simple-timer.rb b/samples/simple-timer.rb
new file mode 100644
index 0000000..9087345
--- /dev/null
+++ b/samples/simple-timer.rb
@@ -0,0 +1,13 @@
+Shoes.app :height => 150, :width => 250 do
+ background rgb(240, 250, 208)
+ stack :margin => 10 do
+ button "Start" do
+ @time = Time.now
+ @label.replace "Stop watch started at #@time"
+ end
+ button "Stop" do
+ @label.replace "Stopped, ", strong("#{Time.now - @time}"), " seconds elapsed."
+ end
+ @label = para "Press ", strong("start"), " to begin timing."
+ end
+end