# Padding of a Gtk::Frame

**URL:** <https://www.ruby-forum.com/t/padding-of-a-gtk-frame/172297>\
**Category:** Ruby-Gnome 2\
**Created:** [July 18, 2009, 10:01pm UTC](https://www.ruby-forum.com/t/padding-of-a-gtk-frame/172297 "2009-07-18T22:01:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [July 18, 2009, 10:01pm UTC](https://www.ruby-forum.com/t/padding-of-a-gtk-frame/172297/1 "2009-07-18T22:01:56Z")

</div>

Hi,

I am trying to stuff some widgets into a Gtk::Frame. My question is, how  
to enable padding of those widgets - or the main widget?

This here won’t work:

frame = Gtk::Frame.new  
frame.pack\_start(main\_box,false,false,20)

I would like to have a padding of ~5 pixels for all the widgets inside  
frame, but I am not sure how to do that easily without .pack\_start

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [July 19, 2009, 9:17am UTC](https://www.ruby-forum.com/t/padding-of-a-gtk-frame/172297/2 "2009-07-19T09:17:33Z")

</div>

Hi,

Marc H. schrieb:

> I am trying to stuff some widgets into a Gtk::Frame. My question is, how  
> to enable padding of those widgets - or the main widget?
> 
> This here won’t work:
> 
> frame = Gtk::Frame.new  
> frame.pack\_start(main\_box,false,false,20)
> 
> I would like to have a padding of ~5 pixels for all the widgets inside  
> frame, but I am not sure how to do that easily without .pack\_start

Gtk::Frame is a child of Gtk::Container → Gtk::Bin so you have to use  
the add or “\<\<” methodes to add a child and not pack\_start. If you want  
to add more than one child, you have to add an other container like a  
Gtk::VBox or a Gtk::Table first.

The padding on all sides is controlled with Gtk::Containers  
set\_border\_width method.

Cheers,

detlef

–  
[http://det.cable.nu](http://det.cable.nu)

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [July 25, 2009, 3:30pm UTC](https://www.ruby-forum.com/t/padding-of-a-gtk-frame/172297/3 "2009-07-25T15:30:45Z")

</div>

Thanks Detlef
