# Help with Shoes

**URL:** <https://www.ruby-forum.com/t/help-with-shoes/148664>\
**Category:** Ruby\
**Created:** [September 16, 2008, 1:14am UTC](https://www.ruby-forum.com/t/help-with-shoes/148664 "2008-09-16T01:14:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rubina](https://www.ruby-forum.com/u/rubina)\
**Post date:** [September 16, 2008, 1:14am UTC](https://www.ruby-forum.com/t/help-with-shoes/148664/1 "2008-09-16T01:14:17Z")

</div>

Hello Ruby/Shoes World!  
As part of my Ruby learning experience I started looking into a GUI  
environment.  
Shoes appears to be simple enough that I would probably be able to learn  
it.  
I am working on a simple Sudoku solver in Ruby, as a Ruby learning  
exercise.  
To this point I have been using stray ASCII output, but I would like to  
beautify it using GUI.

To that effect, I was looking at some of the Shoes sample programs,  
specifically the one named calc.  
I selected calc because it shows how to place several buttons on a row.  
Although the buttons on calc represents the basic symbols of a  
calculator, I  
thought copying the same concept to represents the 9x9 matrix of a  
“regular”  
sudoku puzzle.

The following is the modified code from calc to display the board, and  
for  
which I have some questions:

Shoes.app(:title =\> " A Humble  
Sudoku Solver “, :height =\> 546, :width =\> 617, :resizable =\> false) do  
background “#EEC”…”#996", :radius =\> 5, :top =\> 2, :left =\> 2,  
:width  
=\> -4, :height =\> -4  
stack :margin =\> 0 do  
stack :margin =\> 0  
btn = “123456789”  
flow :width =\> 618, :margin =\> 4 do  
(1…81).each do |n|  
button btn, :width =\> 66, :height =\> 66  
end  
end  
end  
end

1. 
  - For the title, is there some formatting to tell Shoes to center or  
left/right justified a title?

2. 
  - For the background I tried fill green right after the last "  
(double  
quote) but it gave me an error. How could I specified fill green,  
although I  
don’t really need it.

3. 
  - What purpose of :radius =\> 5?

4. 
  - If you are familiar with sudoku, how do you add solid lines to  
separate  
each subgroup of 3x3?

Although I have many more questions, I will continue looking the  
documentation, including nks.

Thank you

Ruby S.

---

<div class="post-metadata">

**Author:** ![rubina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rubina](https://www.ruby-forum.com/u/rubina)\
**Post date:** [September 16, 2008, 11:33pm UTC](https://www.ruby-forum.com/t/help-with-shoes/148664/2 "2008-09-16T23:33:30Z")

</div>

On Tue, Sep 16, 2008 at 08:06:27AM +0900, Ruby S. wrote:

> ```
> flow :width => 618, :margin => 4 do
> (1..81).each do |n|
> button btn, :width => 66, :height => 66
> end
> end
> 
> ```
> 
> end  
> end
> 
> 1. 
> - For the title, is there some formatting to tell Shoes to center or  
> left/right justified a title?

For window titles, no. For titles on the screen, use :align =\>  
“center”.

title “Sudoku Solver”, :align =\> “center”

> 1. 
> - For the background I tried fill green right after the last " (double  
> quote) but it gave me an error. How could I specified fill green, although I  
> don’t really need it.

You want the background to be green, not a gradient?  
Try: background(green)

> 1. 
> - What purpose of :radius =\> 5?

In newer versions of Shoes, this is :curve =\> 5. It curves the  
edges of the background rectangle.

> 1. 
> - If you are familiar with sudoku, how do you add solid lines to separate  
> each subgroup of 3x3?

You’ll want to group the buttons each in their own slot. (A slot is  
the generic name for a `stack` or `flow`.)

Shoes.app(:title =\> "A Humble Sudoku Solver ", :height =\> 546,  
:width =\> 640, :resizable =\> false) do  
background green

```
btn = "123456789"
9.times do
  flow :width => 206, :margin => 4 do
    9.times do
      button btn, :width => 66, :height => 56
    end
  end
end

```

end

I don’t know if this is helpful or just more confusing, but Martin  
DeMello recently wrote a crossword builder. Maybe since sudoku and  
crosswords are relatives, it might have some ideas you could use?  
[http://gist.github.com/11107](http://gist.github.com/11107)

\_why

---

<div class="post-metadata">

**Author:** ![rubina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rubina](https://www.ruby-forum.com/u/rubina)\
**Post date:** [September 16, 2008, 11:44pm UTC](https://www.ruby-forum.com/t/help-with-shoes/148664/3 "2008-09-16T23:44:38Z")

</div>

On Tue, Sep 16, 2008 at 3:13 PM, \_why [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > ```
> > stack :margin => 0 do
> > 
> > ```
> > 
> > 1. 
> > - For the title, is there some formatting to tell Shoes to center or  
> > don’t really need it.  
> > separate  
> > 9.times do  
> > crosswords are relatives, it might have some ideas you could use?  
> > [http://gist.github.com/11107](http://gist.github.com/11107)
> 
> \_why

\_why,

Thank you very much for taking the time to answer my questions. It is  
really  
appreciated.  
I will also look and learn from Martin’s crosswords puzzle.

Thanks again,

Ruby S.

---

<div class="post-metadata">

**Author:** ![rubina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rubina](https://www.ruby-forum.com/u/rubina)\
**Post date:** [September 17, 2008, 12:36am UTC](https://www.ruby-forum.com/t/help-with-shoes/148664/4 "2008-09-17T00:36:20Z")

</div>

It’s \_why!

It’s GIANT FOXES IN SHOES!

Run!!!
