Re: Gtk2::CellRendererText ... one more time for the slow among us




On Oct 22, 2004, at 2:06 AM, Daniel Kasak wrote:

I've been looking at http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/CellRendererText.html and mucking around with various $cell->set() lines for the past half hour, but can't figure out how to format a cell's text in bold. I've got colour sorted, and I can *kinda* change the font size ( I may return to this one later ... I'm getting unpredictable results ). But no bold.

use Gtk2::Pango;  # get the PANGO_WEIGHT_* constants
$cellrenderertext->set (weight => PANGO_WEIGHT_BOLD);

"weight" is the boldness value; the PANGO_WEIGHT_* constants are predefined weight value in a number space.

the "weight-set" property tells the renderer whether to use the value of the "weight" property -- that is, it controls whether the renderer uses the weight you set in. it appears that setting "weight" causes "weight-set" to be set to true, but you can use weight-set to turn bold on and off without having to set and unset the weight value. gtk-demo does this for the example list with italics rather than weight (Gtk2/gtk-demo/main.pl , look for "ITALIC_COLUMN").

--
Examples really shouldn't include unexploded ordnance.
  -- Joe Smith, referring to an example program i wrote.




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