gtk.FontSelection
gtk.FontSelection — a widget for selecting fonts.
Description
The gtk.FontSelection
widget lists the available fonts, styles and sizes, allowing the user to
select a font. It is used in the gtk.FontSelectionDialog
widget to provide a dialog box for selecting fonts. The set_font_name()
method sets the initial font selection. The current font selection is
retrieved using the get_font_name()
method.
The fontselection has a preview area that contains a gtk.Entry that
displays text using the currently selected font. The preview text can be
retrieved with the get_preview_text()
method and set with the set_preview_text()
method.
Filters can be used to limit the font selections. There are 2
filters in the gtk.FontSelection
- a base filter and a user filter. The base filter cannot be changed by the
user, so this can be used when the user must choose from the restricted set
of fonts (e.g. for a terminal-type application you may want to force the
user to select a fixed-width font). The user filter can be changed or reset
by the user, by using the Reset Filter button or
changing the options on the Filter page of the
widget.
Constructor
Returns : | a new fontselection widget |
Creates a new gtk.FontSelection
widget.
Methods
gtk.FontSelection.get_font_name
Returns : | a string containing the selected font
name |
The get_font_name() method returns the
name of the currently selected font.
gtk.FontSelection.set_font_name
def set_font_name(fontname)
|
fontname : | a string containing the name of a
font |
Returns : | TRUE if the font could be
set |
The set_font_name() method sets the
currently selected font in the fontselection using the value of
fontname. The method returns TRUE
if the font is found and can be selected in the fontselection.
gtk.FontSelection.get_preview_text
Returns : | a string containing the preview
text |
The get_preview_text() method returns a
string that contains the text displayed in the preview area entry.
gtk.FontSelection.set_preview_text
def set_preview_text(text)
|
text : | the new preview text
string |
The set_preview_text() method sets the
text to be displayed in the preview area entry using the string in
text.