gtk.FontSelectionDialog
gtk.FontSelectionDialog — a dialog for selecting fonts.
Description
The gtk.FontSelectionDialog
is a dialog box containing a gtk.FontSelection
widget that the user can use to select a font according to the desired
family, style and size.
The set_font_name()
method sets the initial font selection. The current font selection is
retrieved using the get_font_name()
method. The font selection dialog 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.FontSelectionDialog
- 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.
Note
In GTK+ 2.2 and above the gtk.FontSelectionDialog
does not have filters, a Reset Filter button or a
Filter page.
Constructor
gtk.FontSelectionDialog(title)
|
title : | a string to be used as the dialog
title |
Returns : | a new font selection dialog |
Creates a new gtk.FontSelectionDialog
with the title specified by title.
Methods
gtk.FontSelectionDialog.get_font_name
Returns : | the currently selected font name or None if no
font is selected. |
The get_font_name() method returns a
string containing the currently selected font name or None if no font name
is selected.
gtk.FontSelectionDialog.set_font_name
def set_font_name(fontname)
|
fontname : | a string containing the font name to be
set |
Returns : | TRUE if the font is found
and can be selected |
The set_font_name() method sets the
current font using the value of fontname. The method
returns TRUE if the font exists and could be
selected.
gtk.FontSelectionDialog.get_preview_text
Returns : | a string containing the text in the preview
area entry |
The get_preview_text() method returns a
string containing the text in the preview area entry.
gtk.FontSelectionDialog.set_preview_text
def set_preview_text(text)
|
text : | a string used to set the text in the preview
area entry |
The set_preview_text() method sets the
text in the preview area entry using the string specified by
text.