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.
Methods
gtk.FontSelection.get_font_name
def 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
def 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
.
gtk.FontSelection.get_face
def get_face()
Returns : | A pango.FontFace
representing the selected font group details. |
Note
This method is available in PyGTK 2.14 and above.
The get_face
() method gets the
pango.FontFace
representing the selected font group details (i.e. family, slant, weight, width, etc).
gtk.FontSelection.get_face_list
def get_face_list()
Note
This method is available in PyGTK 2.14 and above.
The get_face_list
() method returns the
gtk.TreeView
which lists all styles available for the selected font. For example, 'Regular', 'Bold', etc.
gtk.FontSelection.get_family
def get_family()
Returns : | A pango.FontSelection
representing the selected font family. Font families are a collection of font faces. |
Note
This method is available in PyGTK 2.14 and above.
The get_family
() method gets the
pango.FontSelection
representing the selected font family.
gtk.FontSelection.get_family_list
def get_family_list()
Note
This method is available in PyGTK 2.14 and above.
The get_family_list
() method returns the
gtk.TreeView
that lists font families, for example, 'Sans', 'Serif', etc.
gtk.FontSelection.get_preview_entry
def get_preview_entry()
Note
This method is available in PyGTK 2.14 and above.
The get_preview_entry
() method returns the
gtk.Entry
used to display the font as a preview.
gtk.FontSelection.get_size
def get_size()
Returns : | A n integer representing the selected font size,
or -1 if no font size is selected. |
Note
This method is available in PyGTK 2.14 and above.
The get_size
() method returns the selected font size.
gtk.FontSelection.get_size_entry
def get_size_entry()
Note
This method is available in PyGTK 2.14 and above.
The get_preview_entry
() method returns the
gtk.Entry
used to allow the user to edit the font number manually instead of
selecting it from the list of font sizes.
gtk.FontSelection.get_size_list
def get_size_list()
Note
This method is available in PyGTK 2.14 and above.
The get_size_list
() method returns the
gtk.TreeView
used to list font sizes.