Re: Label Attributes

Mario Ospelt said:

I want to change the fontweight and fontsize of a Gtk2::Label. I saw in
the reference manual that I have to use a Gtk2::Pango::AttrList. But the
method new() is not available. How can I do that although? (I had also a
look at Gtk2::Text, but that seems to be deprecated.)

  # use Pango Markup, an html-like syntax...
  $markup_string = "My <big><span color=\"blue\">Cool</span> string</big>";

  # let gtk+ do the PangoAttrList stuff internally
  $label->set_markup ($markup_string);

  # or do it yourself for very little gain.
  ($attr_list, $text, $accel_char) =
      Gtk2::Pango->parse_markup ($markup_string, 0);
  $label->set (text => $text,
               attributes => $attr_list);

muppet <scott at asofyet dot org>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]