gtk.FontButton
Prev | The gtk Class Reference | Next

## gtk.FontButton

gtk.FontButton — a button to launch a font selection dialog (new in PyGTK 2.4)

## Synopsis

    class gtk.FontButton(gtk.Button):
        gtk.FontButton(fontname=None)
        def get_title()
        def set_title(title)
        def get_use_font()
        def set_use_font(use_font)
        def get_use_size()
        def set_use_size(use_size)
        def get_font_name()
        def set_font_name(fontname)
        def get_show_style()
        def set_show_style(show_style)
        def get_show_size()
        def set_show_size(show_size)

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Container
            +-- gtk.Bin
              +-- gtk.Button
                +-- gtk.FontButton

## gtk.FontButton Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

gtk.Button Properties

"font-name" | Read-Write | The name of the currently selected font.
"show-size" | Read-Write | If `True`, the selected font size will be shown in the label. For a more WYSIWIG way to show the selected size, see the "use-size" property.
"show-style" | Read-Write | If `True`, the name of the selected font style will be shown in the label. For a more WYSIWIG way to show the selected style, see the "use-font" property.
"title" | Read-Write | The title of the font selection dialog.
"use-font" | Read-Write | If `True`, the label will be drawn in the selected font
"use-size" | Read-Write | If `True`, the label will be drawn with the selected font size.

## gtk.FontButton Style Properties

gtk.Widget Style Properties

gtk.Button Style Properties

## gtk.FontButton Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

gtk.Button Signal Prototypes

"font-set" | `def callback(`fontbutton`, `user_param1`, `...`)`

## Description

### Note

This widget is available in PyGTK 2.4 and above.

The `gtk.FontButton` is a button that displays the currently selected font and, when clicked, opens a `gtk.FontSelectionDialog` to change the font. A `gtk.FontButton` can be used in a preference dialog for selecting a font.

## Constructor

        gtk.FontButton(fontname=None)

`fontname` : | the name of the font to display in the font selection dialog
Returns : | a new font button widget

### Note

This constructor is available in PyGTK 2.4 and above.

Creates a new `gtk.FontButton` that displays the font specified by `fontname` or the currently selected font if `fontname` is `None` or not specified.

## Methods

### gtk.FontButton.get_title

        def get_title()

Returns : | the title string

### Note

This method is available in PyGTK 2.4 and above.

The `get_title`() method returns the value of the "title" property that contains the title of the font selection dialog.

### gtk.FontButton.set_title

        def set_title(title)

`title` : | a string containing the font selection dialog title

### Note

This method is available in PyGTK 2.4 and above.

The `set_title`() method sets the "title" property to the string specified by `title` and sets the title of the `gtk.FontSelectionDialog` if it exists. The "title" property contains the title of the font selection dialog.

### gtk.FontButton.get_use_font

        def get_use_font()

Returns : | `True`, if the font button label is written using the selected font.

### Note

This method is available in PyGTK 2.4 and above.

The `get_use_font`() method returns the value of the "use-font" property. If "use-font" is `True` the selected font is used in the label.

### gtk.FontButton.set_use_font

        def set_use_font(use_font)

`use_font` : | If `True`, the font button label will be written using the font selected.

### Note

This method is available in PyGTK 2.4 and above.

The `set_use_font`() method sets the "use-font" property to the value specified by `use_font`. If `use_font` is `True`, the font button label will be written using the selected font.

### gtk.FontButton.get_use_size

        def get_use_size()

Returns : | `True` if the font button label is written using the selected size.

### Note

This method is available in PyGTK 2.4 and above.

The `get_use_size`() method returns the value of the "use-size" property. If the value of "use-size" is `True`, the font button label is written using the selected font size.

### gtk.FontButton.set_use_size

        def set_use_size(use_size)

`use_size` : | If `True`, the font button label will be written using the selected size.

### Note

This method is available in PyGTK 2.4 and above.

The `set_use_size`() method sets the "use-size" property to the value of `use_size`. If `use_size` is `True`, the font button label will be written using the selected size.

### gtk.FontButton.get_font_name

        def get_font_name()

Returns : | the font name.

### Note

This method is available in PyGTK 2.4 and above.

The `get_font_name`() method returns the value of the "font-name" property that contains the name of the currently selected font.

### gtk.FontButton.set_font_name

        def set_font_name(fontname)

`fontname` : | the name of the font to display in the font selection dialog
Returns : | `True` if the font selection dialog exists and the font name could be set

### Note

This method is available in PyGTK 2.4 and above.

The `set_font_name`() method sets the "font-name" property to the value of `fontname` and updates the currently-displayed font in the font selection dialog. Returns `True` if the font selection dialog exists and `fontname` could be set as its font.

### gtk.FontButton.get_show_style

        def get_show_style()

Returns : | `True` if the font style will be shown in the label.

### Note

This method is available in PyGTK 2.4 and above.

The `get_show_style`() method returns the value of the "show-style" property. If "show-style" is `True`, the name of the font style will be shown in the font button label.

### gtk.FontButton.set_show_style

        def set_show_style(show_style)

`show_style` : | if `True`, the font style should be displayed in the font button label.

### Note

This method is available in PyGTK 2.4 and above.

The `set_show_style`() method sets the "show-style" property tot he value of `show_style`. If `show_style` is `True`, the font style will be displayed along with name of the selected font in the font button label.

### gtk.FontButton.get_show_size

        def get_show_size()

Returns : | `True` if the font size will be shown in the font button label.

### Note

This method is available in PyGTK 2.4 and above.

The `get_show_size`() method returns the value of the "show-size" property. If "show-size" is `True`, the font size will be shown in the font button label.

### gtk.FontButton.set_show_size

        def set_show_size(show_size)

`show_size` : | if `True`, the font size should be displayed in the font button label.

### Note

This method is available in PyGTK 2.4 and above.

The `set_show_size`() method sets the "show-size" property to to the value of `show_size`. If `show_size` is `True`, the font size will be displayed along with the name of the selected font in the font button label.

## Signals

### The "font-set" gtk.FontButton Signal

        def callback(fontbutton, user_param1, ...)

`fontbutton` : | the fontbutton that received the signal
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)

The "font-set" signal is emitted when the user selects a font. When handling this signal, use the `get_font_name`() method to find out what font was just selected.

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