Ruby GTK modify widget colors
ulli bei Unity <[email protected]>
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I want to modify the widget colors in GTK3. I only found an example with
GTK2.
With GTK3 it doesn't work.
Has someone a solution?
Regards
UH
require 'gtk2'
window= Gtk::Window.new
window.set_size_request(300,200)
button= Gtk::Button.new('Button')
button.set_size_request(100,-1)
font= Pango::FontDescription.new('28')
button.child.modify_font(font)
yellow= Gdk::Color.new(65535,65535,0)
cyan= Gdk::Color.new(0,65535,65535)
green= Gdk::Color.new(0,65535,0)
magenta= Gdk::Color.new(65535,0,65535)
white= Gdk::Color.new(65535,65535,65535)
blue= Gdk::Color.new(0,0,65535)
# background color of the button
button.modify_bg(Gtk::STATE_NORMAL , yellow)
button.modify_bg(Gtk::STATE_PRELIGHT, cyan)
button.modify_bg(Gtk::STATE_ACTIVE , green)
# label color of the button
button.child.modify_fg(Gtk::STATE_NORMAL , magenta)
button.child.modify_fg(Gtk::STATE_PRELIGHT, blue)
button.child.modify_fg(Gtk::STATE_ACTIVE , white)
fixed= Gtk::Fixed.new
fixed.put(button,10,10)
window.add(fixed)
window.show_all
window.signal_connect("destroy") {Gtk.main_quit }
Gtk.main
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>