gtk.FontSelectionDialog
Prev | The gtk Class Reference | Next

## gtk.FontSelectionDialog

gtk.FontSelectionDialog — a dialog for selecting fonts.

## Synopsis

    class gtk.FontSelectionDialog(gtk.Dialog):
        gtk.FontSelectionDialog(title)
        def get_font_name()
        def set_font_name(fontname)
        def get_preview_text()
        def set_preview_text(text)

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Container
            +-- gtk.Bin
              +-- gtk.Window
                +-- gtk.Dialog
                  +-- gtk.FontSelectionDialog

## gtk.FontSelectionDialog Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

gtk.Window Properties

gtk.Dialog Properties

## gtk.FontSelectionDialog Style Properties

gtk.Widget Style Properties

gtk.Dialog Style Properties

## Attributes

"fontsel" | Read | The `gtk.FontSelection` widget in the dialog.
"main_vbox" | Read | The `gtk.VBox` that contains all the dialog widgets
"action_area" | Read | The `gtk.HBox` containing the action buttons
"ok_button" | Read | The OK button
"apply_button" | Read | The Apply button
"cancel_button" | Read | The Cancel button

## gtk.FontSelectionDialog Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

gtk.Window Signal Prototypes

gtk.Dialog Signal Prototypes

## 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

        def 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

        def 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`.

Prev | Up | Next
gtk.FontSelection | Home | gtk.Frame