This is directly supported by the label widget:

let w = GWindow.window ()
let l = GMisc.label ~packing:w#add ()
let () =
  l#set_text "<span foreground=\"red\">Hello</span>";
  l#set_use_markup true;
  w#show ();
  GMain.main ()

This is even shorter as optional argument:

let l = GMisc.label ~packing:w#add ~markup:"<span 
foreground=\"red\">Hello</span>" ()

Jacques Garrigue

On 2010/11/29, at 22:20, Daniel de Rauglaudre wrote:

> Hi,
> 
> I'd like to have a "label" widget in Lablgtk with a string with
> internationalization, bold, italic, utf8, color, things like that.
> 
> I am not sure, but I saw in the Web that I must use the function
> "pango_parse_markup" and XML tags in my string, but that function
> seems not to exist in Lablgtk. Is it normal? Do I have to use other
> features?
> 
> Thanks.
> 
> -- 
> Daniel de Rauglaudre
> http://pauillac.inria.fr/~ddr/

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to