Re: To Increase Font size in Combo Widget and background color of combowidget



Quoting parakala suma <parakalas yahoo com>:
Hi
I am trying to increase font size of text in combo widget and also
background color
of combo widget in Gtk2-perl.
Kindly help me
Thanks
Suma

Gtk2::Widget (the base class for all widgets) has a method called modify_font
which expects a Gtk2::Pango::FontDescription.  You can set the font easily like
this:

$combo->modify_font(Gtk2::Pango::FontDescription->from_string('Serif 20');

The three fonts you are most likely to use are:

Serif        - non-proportional, has little toots on it to make it flow nicely
Sans         - non-proportional, no toots, stands out (use for headings)
Monospace    - proportional (fixed), use anything that needs to line up (code)

You can use any of the fonts installed on your system, but these are guarenteed
to be there.  They coorespond to Times New Roman, Ariel, and Courier New
respectivly.

Gtk2::Widget also has a method modify_bg that takes a state ('normal', 'active',
'prelight', 'selected', 'insensitive') and a Gtk2::Gdk::Color object.  Example:

my $color = Gtk2::Gdk::Color->parse('red');
for my $state ('normal', 'active', 'prelight', 'selected', 'insensitive') {
        $combo->modify_bg($state, $color);
}

You may be interested in the docs at http://developer.gnome.org/doc/API/. 
Remember that these are written for the natvie C interface, but you can
translate what they say with the info in Gtk2::api.  One important tip is to
look at all of the object your current widget inherits from.  The function you
are looking for may be in one of them.



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