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_selection()
        def get_font_name()
        def set_font_name(fontname)
        def get_preview_text()
        def set_preview_text(text)
        def get_apply_button()
        def get_cancel_button()
        def get_ok_button()

## Ancestry

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

## Implemented Interfaces

`gtk.FontSelectionDialog` implements `gtk.Buildable`

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

        def get_font_selection()

Returns : | the embedded `gtk.FontSelection`.

### Note

This method is available in PyGTK 2.22 and above.

The `get_font_selection`() method retrieves the `gtk.FontSelection` widget embedded in the dialog.

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

### gtk.FontSelectionDialog.get_apply_button

        def get_apply_button()

Returns : | a `gtk.Widget`.

### Note

This method is available in PyGTK 2.14 and above but it will be deprecated in 2.16 don't use this method.

The `get_apply_button`() method obtains a button. The button doesn't have any function.

### gtk.FontSelectionDialog.get_cancel_button

        def get_cancel_button()

Returns : | the `gtk.Widget`. used in the dialog for the 'Cancel' button.

### Note

This method is available in PyGTK 2.14 and above.

The `get_cancel_button`() method gets the 'Cancel' button.

### gtk.FontSelectionDialog.get_ok_button

        def get_ok_button()

Returns : | the `gtk.Widget`. used in the dialog for the 'OK' button.

### Note

This method is available in PyGTK 2.14 and above.

The `get_ok_button`() method gets the 'OK' button.

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