Bordered Gtk Label

M

Martin DeMello

How do I draw a rectangular border around a Gtk Label? Also, is there
any way to set the background colour on an individual widget?

martin
 
M

Martin DeMello

Martin DeMello said:
How do I draw a rectangular border around a Gtk Label? Also, is there
any way to set the background colour on an individual widget?

FWIW the answers are

1. Enclose it in a Gtk::Frame (at least, that's the best I could come up
with)

2. Gtk::Widget#modify_bg(state, colour)

(From Geoff Youngs on the ruby-gnome2 mailing list:
ISTR that this only works for widgets which actually have a background
window, otherwise you'll need to wrap the widget in a Gtk::EventBox,
which does.

e.g.
col = Gdk::Color.parse("red")
label = Gtk::Label.new("Warning")
eb = Gtk::EventBox.new()
eb.add(label)
eb.modify_bg(Gtk::STATE_NORMAL, col)
)

martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top