GUI Designer for GTK? / Resizing widgets in table

Hello-
First, I would like to ask if there is a GUI Designer for GTK that works
with Ruby. I DO NOT MEAN GLADE. I hate Glade. I do NOT want to use some
annoying xml files, even if they are ‘easier’. I would need a NORMAL GUI
Designer, as in something that gives me the RAW RUBY code for the GUI as
output.

Question 2:
So, I have a table widget.(Because of course, GTK has this
useless/insane/awful ‘container’ format, which means that it hates
something called SPACE, and forces you to put everything into
tables/boxes)

Inside a part of the table(table.attach) I have a toolbar. On the
toolbar, I have a button.

Of course, GTK HATES SPACE. So, of course, the toolbar takes up as much
space as possible until it bumps into other widgets.

Then, the button takes up as much space as possible on the toolbar.

So then, I use this:
button.set_size_request(x, y)

Now. The x value ACTUALLY RESIZES THE WIDGET’s WIDTH! Hurray!

However, the y value does not resize the button’s height! It STILL
stretches ALL the way down the toolbar until the toolbar and the button
smash into other widgets.

How would I resize the button height? What about the toolbar’s?

Basically, I want to go against everything GTK tries to do and actually
CREATE SOME SPACE inbetween the toolbar/button cell(By making this a
NORMAL SIZED toolbar, instead of half the freaking window).

How would I do this? How would I resize any part of the table or
widget??

Avery W. wrote:

Hello-
First, I would like to ask if there is a GUI Designer for GTK that works
with Ruby. I DO NOT MEAN GLADE. I hate Glade. I do NOT want to use some
annoying xml files, even if they are ‘easier’. I would need a NORMAL GUI
Designer, as in something that gives me the RAW RUBY code for the GUI as
output.

Glade appears as a “normal gui designer” for me. I don’t undestand why
you want raw ruby code from a gui designer. This would most probably
only work as a code generator, which can write the code once, but
read/modify never.

I’m not a fan of XML files, too, but glade just works for me.

Of course, GTK HATES SPACE. So, of course, the toolbar takes up as much
space as possible until it bumps into other widgets.

Well that’s how GTK works.

How would I do this? How would I resize any part of the table or
widget??

Can you post an example? Your uppercase text doesn’t improve
readability…

Sorry. I was frustrated when I wrote that…

OK, here we go.

Mytable = Gtk::Table.new(3, 1, false)
window.add(Mytable)

toolbar1 = Gtk::Toolbar.new
bnt1 = Gtk::Button.new(“hello”)
toolbar1.append(bnt1)
bnt1.set_size_request(40,10)
toolbar1.set_size_request(100,30)
Mytable.attach_defaults(toolbar1, 0, 1, 0, 1)

toolbar2 = Gtk::Toolbar.new
bnt2 = Gtk::Button.new(“Hello2”)
toolbar2.appen(bnt2)
table.attach_defaults(toolbar2, 0, 1, 2, 3)

When I run this, I get both of the buttons/toolbars/table cells
stretching out to meet each other in the middle. I would just like to
understand how to fix this.
toolbar1.set_size_request() seems to do nothing.
bnt1.set_size request can change the width of the button, but not the
height.

Thanks for your time,
Avery

Hey Avery,

A few comments:

  1. The GTK layout system is one of the best I’ve seen around. You only
    need to get the hang of it.

  2. You don’t wanna use set_size_request. This defeats the whole porpouse
    of the layout system. Use it only on very specific things.

  3. You don’t wanna use a Gtk::Table for something like this. Use a
    Gtk::VBox.

The secret is in the “expand” and “fill” properties of the VBox.
“Expand” means that the widget will try to occupy all space in the
window, pushing all other widgets aside. “Fill” means the widget will
occupy all space reserved for it.

So, first add a vbox to that window. Then you add a toolbar to the vbox.
To add the toolbar, use vbox.pack_start(toolbar, false). The ‘false’
means that expand is false, that is, the toolbar will occupy smallest
space possible. If you were to put expand as true, the toolbar would
occupy the whole screen.

  1. To add a button to a toolbar, don’t use a Gtk::Button. Use
    Gtk::Toolbar#append.

  2. Criticizing the tool that the members of the group are developing and
    working with is rarely good politics. Next time try to wait until
    frustration passes, then post. You might get more prompt answers.

  3. Try taking a look at the samples directory that is packed with GTK.
    Studying those simple examples can teach you a lot about Ruby-Gnome.

Best regards and good luck.

André

On Tue, 8 Jul 2008 22:46:42 +0200
Avery W. [email protected] wrote:

toolbar1.set_size_request(100,30)
toolbar1.set_size_request() seems to do nothing.
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08


ruby-gnome2-devel-en mailing list
[email protected]
ruby-gnome2-devel-en List Signup and Options


Lamentação sem gratidão é murmuração. (Howard Hendricks)

André Wagner wrote:

  1. Try taking a look at the samples directory that is packed with GTK.
    Studying those simple examples can teach you a lot about Ruby-Gnome.

Hey there, are you referring to the GTK2 samples, located at
http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk’? If you are - great
minds think alike. If not, that tutorial is helpful, too.