# Shoes toolket

**URL:** <https://www.ruby-forum.com/t/shoes-toolket/143082>\
**Category:** Ruby\
**Created:** [July 15, 2008, 1:10am UTC](https://www.ruby-forum.com/t/shoes-toolket/143082 "2008-07-15T01:10:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edward\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/76d3ee/32.png) [@Edward\_R](https://www.ruby-forum.com/u/Edward_R)\
**Post date:** [July 15, 2008, 1:10am UTC](https://www.ruby-forum.com/t/shoes-toolket/143082/1 "2008-07-15T01:10:58Z")

</div>

I have been trying to write a few programs with shoes.  
I am wondering if there is a way to change the background from within  
a button.

I have tried something like the following but it does not work.

Shoes.app ‘change’ do

button ‘quit’ do  
exit  
end

button ‘change’ do  
background ‘rgb(200,0,0)’  
end  
end

It should be quite easy I just am not clear on the syntex.

thanks

---

<div class="post-metadata">

**Author:** ![Edward\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/76d3ee/32.png) [@Edward\_R](https://www.ruby-forum.com/u/Edward_R)\
**Post date:** [July 15, 2008, 3:50am UTC](https://www.ruby-forum.com/t/shoes-toolket/143082/2 "2008-07-15T03:50:43Z")

</div>

On Mon, 14 Jul 2008 23:05:18 +0000, Edward R. wrote:

> button ‘change’ do  
> background ‘rgb(200,0,0)’  
> end  
> end
> 
> It should be quite easy I just am not clear on the syntax.
> 
> thanks

I have figured it out.  
it is not that I had it wrong. Just that the background was not  
refreshed. by adding "self.show ". It now refreshes itself

here is the program as it stands.

Shoes.app do  
background ‘rgb(0, 0, 220)’  
line 10,10,300,300  
flow do  
quit = button “quit” do  
exit  
end  
button “change” do  
color1 = rgb(rand(255),rand(255),rand(255))  
background color1  
self.show  
end  
button “change2” do  
color2 = ask\_color(“Give me the Color”)  
puts color2.class  
background color2  
self.show  
end  
end  
end
