gtk.FontSelection — a widget for selecting fonts.
class gtk.FontSelection(gtk.VBox): |
+--gobject.GObject +-- gtk.Object +-- gtk.Widget +-- gtk.Container +-- gtk.Box +-- gtk.VBox +-- gtk.FontSelection
|
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 button or
changing the options on the Filter page of the
widget.
gtk.FontSelection()
Returns : | a new fontselection widget |
Creates a new gtk.FontSelection
widget.
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.
def set_font_name(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.
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.
def set_preview_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
.
def get_face()
Returns : | A pango.FontFace
representing the selected font group details. |
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).
def get_face_list()
Returns : | A
gtk.Widget
that is part of fontsel. |
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.
def get_family()
Returns : | A pango.FontSelection |
This method is available in PyGTK 2.14 and above.
The get_family
() method gets the
pango.FontSelection
def get_family_list()
Returns : | A
gtk.Widget
that is part of fontsel. |
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.
def get_preview_entry()
Returns : | A
gtk.Widget
that is part of fontsel. |
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.
def get_size()
Returns : | A n integer representing the selected font size, or -1 if no font size is selected. |
This method is available in PyGTK 2.14 and above.
The get_size
() method returns the selected font size.
def get_size_entry()
Returns : | A
gtk.Widget
that is part of fontsel. |
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.
def get_size_list()
Returns : | A
gtk.Widget
that is part of fontsel. |
This method is available in PyGTK 2.14 and above.
The get_size_list
() method returns the
gtk.TreeView
used to list font sizes.