Hi all,
It’s been spoken about four times before, so I apologize for being
dense. Does any one have an example of how to change a window’s
background color in visual ruby?
VisualRuby does a good job of being simple and straightforward, so it’s
tough to know how to port the perl or python examples, or even the ruby
examples.
Thanks,
Andru
Hi Andru:
Normally, I like setting attributes like background color using glade if
I’m going to keep the same color at all times. However, I don’t see any
setting in glade to set the background.
You can always do this:
def before_show
blue = Gdk::Color.parse("#CFFCFF")
@builder[“window1”].modify_bg(Gtk::STATE_NORMAL, blue)
end
Best,
Eric
Thanks a lot Eric! Works like a charm. I added it to show()
def show()
load_glade(FILE)
set_glade_all()
blue = Gdk::Color.parse("#CFFCFF")
@builder[“window1”].modify_bg(Gtk::STATE_NORMAL, blue)
show_window()
end
A
No problem Andru.
Actually, since the last upgrade of vr, you can rewrite that method like
so:
def before_show()
blue = Gdk::Color.parse("#CFFCFF")
@builder[“window1”].modify_bg(Gtk::STATE_NORMAL, blue)
end
There is a now a show() method in GladeGUI, and it calls before_show()
before showing the window on the screen.
The load_glade() and set_glade_all() methods don’t need to be used in
most programs since the last upgrade. The glade form is now
automatically loaded and all the variables are automatically set.
In fact, if you don’t need to set the background color, you wouldn’t
need any “show” type method at all. Most times you can just make the
control names the same as your variable names, and do this:
MyClass.new.show
Understand? I’m sorry I haven’t documented it yet, but you can
re-install the examples, and they demo the new format.
Thanks,
Eric
Thanks so much. I wish I could take credit for everything, but like you
said, I’m jut putting together great things that others have created.
Without Ruby language then ruby-gnome then visualruby with the
assistance of the glade people none of it is possible.
Not to mention that I’ve been totally dependent on the geniuses on this
site for advise.
I’d love to see what you make with it.
Eric
I used to work at a community television station and built their playout
system (kind of as an after work hobby). Now I am volunteering to finish
it off (so someone else can look after it hopefully!).
I’m using a bunch of pieces like VLC and powerpoint to run the station
in a novel way.
I have an image of an early mockup.
It’s kind of like a very long chess game.
I think I do understand.
Eric, you have created a thing of magic. I still can’t believe that I
can use Ruby to create a GUI interface. I know that we are all standing
on the shoulders of giants here, but you have created this last link
that works so well for me.
Thanks,
Andru