Bordered Gtk Label

Discussion in 'Ruby' started by Martin DeMello, Jul 6, 2005.

  1. 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
     
    Martin DeMello, Jul 6, 2005
    #1
    1. Advertising

  2. Martin DeMello <> wrote:
    > 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
     
    Martin DeMello, Jul 7, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    548
  2. Replies:
    20
    Views:
    948
    toxee
    Jan 24, 2009
  3. toxee

    Image bordered div Vol. II

    toxee, Jan 25, 2009, in forum: HTML
    Replies:
    6
    Views:
    464
    toxee
    Jan 26, 2009
  4. Paul Hemans
    Replies:
    2
    Views:
    2,173
    Paul Hemans
    May 9, 2010
  5. Knut Krueger
    Replies:
    8
    Views:
    340
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page