Re: how to change the font of a button and textbox data



Hi,

On 16 Dec 2004 05:28:07 -0000, Sudha C Naidu <sudhacnaidu rediffmail com> wrote:
>  how do i change font style of a button and text box data?
>  i am able to change font style of a label using:
>  font_bold=gdk_font_load("-adobe-courier-bold-r-normal--*-130-*-*-*-*-*-*");
>       style = gtk_style_copy(gtk_widget_get_style(widget));
>       style->font=font_bold;
>  
>  but this doesnt work for a button....

That looks like the old and busted gtk+-1.2 way. You should use label
markup instead -- something like:

  label = gtk_label_new();
  gtk_label_set_markup( label, "<span font_desc=\"Mono\">My text</span>" );
  button = gtk_button_new();
  gtk_container_add( button, label );

then later, to change the font:

  gtk_label_set_markup( label, "<span font_desc=\"Serif\">My text</span>" );

John



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