one should not post long source codes in text, but here you go:
Shoes.app :height=> 500, :width=> 500 do
background white
#fugägerampel
fill gainsboro
rect 10,50,90,130
fill red
a1=oval :top=> 60, :left=> 30, :radius=> 25
fill black
a2=oval :top=> 120, :left=> 30, :radius=> 25
#autoampel
fill gainsboro
rect 210,45,150,300
fill black
b1=oval :top=> 50, :left=> 245, :radius=> 40
fill black
b2=oval :top=> 150, :left=> 245, :radius=> 40
fill green
b3=oval :top=> 250, :left=> 245, :radius=> 40
def alle (dauer)
tn=Time.now.to_i #Prozedur alle
te=tn+dauer
while tn<te do
tn=Time.now.to_i
end
end
stack :margin=> 30, :top=> 150 do
button "Walk" do
#fugängerampel
alle 5 do
fill red
a1=oval :top=> 60, :left=> 30, :radius=> 25
fill black
a2=oval :top=> 120, :left=> 30, :radius=> 25
end
#Autoampel
alle 5 do
fill black
b1=oval :top=> 50, :left=> 245, :radius=> 40
fill black
b2=oval :top=> 150, :left=> 245, :radius=> 40
fill green
b3=oval :top=> 250, :left=> 245, :radius=> 40
end
end
end
end
and the Test programm:
def pause (dauer)
tn = Time.now.to_i
te = tn+dauer
while tn<te do
tn = Time.now.to_i
end
end
Shoes.app do
fill white
rect 10,50,90,130
stack do
button "P" do
pause (2)
fill red
oval :top=> 50, :left=> 150, :radius=> 25
pause (15)
fill green
oval :top=> 150, :left=> 150, :radius=> 25
end
end
end