# A Noob question about gtk

**URL:** <https://www.ruby-forum.com/t/a-noob-question-about-gtk/172535>\
**Category:** Ruby-Gnome 2\
**Created:** [July 23, 2009, 12:16am UTC](https://www.ruby-forum.com/t/a-noob-question-about-gtk/172535 "2009-07-23T00:16:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [July 23, 2009, 12:16am UTC](https://www.ruby-forum.com/t/a-noob-question-about-gtk/172535/1 "2009-07-23T00:16:55Z")

</div>

im putting a few buttons inside of a gtk::alignment, but i can figure  
how to put them in, i know that im supposed to do something like  
“add\_child(builder, child, type)” but what do i put for the builder??

sorry if i sound , im a real noob

* * *

Use Linux!!

---

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [July 23, 2009, 2:10pm UTC](https://www.ruby-forum.com/t/a-noob-question-about-gtk/172535/2 "2009-07-23T14:10:53Z")

</div>

John Rivera wrote:

> im putting a few buttons inside of a gtk::alignment, but i can figure  
> how to put them in, i know that im supposed to do something like  
> “add\_child(builder, child, type)” but what do i put for the builder??

I think you are looking for Gtk::Container#add, and not  
Gtk::Bin#add\_child.

(pseudo code, not tested)

align = Gtk::Alignment.new(0, 0, 1, 1)  
b1 = Gtk::Button.new(“Test”)  
b2 = Gtk::Button.new(“Test”)  
align.add(b1)  
align \<\< b2

See [http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AContainer#add](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AContainer#add)

Simon

---

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [July 23, 2009, 2:16pm UTC](https://www.ruby-forum.com/t/a-noob-question-about-gtk/172535/3 "2009-07-23T14:16:58Z")

</div>

After reading closer the Gtk::Alignment doc, you can only pack one  
widget into it.

So, if you are looking to pack many buttons, you should look at the  
different boxes : Gtk::VBox, Gtk::HButtonBox, etc.  
Or maybe, the Gtk::Table or Gtk::Fixed containers.

Look the containers in the doc :  
[http://ruby-gnome2.sourceforge.jp/hiki.cgi?Ruby%2FGTK](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Ruby%2FGTK)

Simon

---

<div class="post-metadata">

**Author:** ![jjrussell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Post date:** [July 23, 2009, 7:17pm UTC](https://www.ruby-forum.com/t/a-noob-question-about-gtk/172535/4 "2009-07-23T19:17:58Z")

</div>

im just trying to add one child to Gtk::Alignment
