gtk.FileChooserButton

gtk.FileChooserButton — a button to launch a gtk.FileChooserDialog (new in PyGTK 2.6)

Synopsis

class gtk.FileChooserButton(gtk.HBox):
    gtk.FileChooserButton(title, backend=None)
gtk.FileChooserButton(dialog)
def get_title()
def set_title(title)
def get_width_chars()
def set_width_chars(n_chars)

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.Container
        +-- gtk.Box
           +-- gtk.HBox
             +-- gtk.FileChooserButton

Properties

"dialog"Write-Construct OnlyThe gtk.FileChooserDialog associated with the button.
"title"Read-WriteThe string to use as the title on the gtk.FileChooserDialog associated with the button.
"width-chars"Read-WriteThe width of the entry and label inside the button, in characters. Allowed values: >= -1. Default value: -1

Description

Note

This widget is available in PyGTK 2.6 and above.

The gtk.FileChooserButton is a widget that lets the user select a file. It implements the gtk.FileChooser interface. Visually, it is a file name with a button to bring up a gtk.FileChooserDialog. The user can then use that dialog to change the file associated with that button. This widget does not support setting the "select-multiple" property to TRUE. For example to create a gtk.FileChooserButton and set the current folder to '/etc' use:

  filechooserbutton = gtk.FileChooserButton('Select a File')
  filechooserbutton.set_current_folder('/etc')

The gtk.FileChooserButton supports the gtk.FILE_CHOOSER_ACTION_OPEN and gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER actions of the GTK FileChooser Action Constants.

Note

The gtk.FileChooserButton will ellipsize the label, and thus will thus request little horizontal space. To give the button more space, you should call the gtk.Widget.size_request() method, the set_width_chars() method, or pack the button in such a way that other interface elements give space to the widget.

Constructor

gtk.FileChooserButton

    gtk.FileChooserButton(title, backend=None)
title :the title of the browse dialog
backend :the name of a file system backend or None
Returns :a new gtk.FileChooserButton

Note

This constructor is available in PyGTK 2.6 and above.

Creates a new button widget that opens a gtk.FileChooserDialog when clicked. The title of the gtk.FileChooserDialog is specified by title. If backend is specified it is the name of a file system backend.

gtk.FileChooserButton

    gtk.FileChooserButton(dialog)
dialog :a gtk.FileChooserDialog
Returns :a new gtk.FileChooserButton

Note

This constructor is available in PyGTK 2.6 and above.

Creates a new button widget that opens a gtk.FileChooserDialog specified by dialog when clicked.

Methods

gtk.FileChooserButton.get_title

    def get_title()
Returns :the title of the gtk.FileChooserDialog

Note

This method is available in PyGTK 2.6 and above.

The get_title() method returns the value of the "title" property which contains the title of the associated gtk.FileChooserDialog.

gtk.FileChooserButton.set_title

    def set_title(title)
title :a string to use as the title of the associated gtk.FileChooserDialog.

Note

This method is available in PyGTK 2.6 and above.

The set_title() method sets the "title" property to the value of title. The "title" property contains the title string of the associated gtk.FileChooserDialog.

gtk.FileChooserButton.get_width_chars

    def get_width_chars()
Returns :,  :, the width in characters of the button

Note

This method is available in PyGTK 2.6 and above.

The get_width_chars() method returns the value of the "width-characters" property which contains the number of characters the button width should be set to.

gtk.FileChooserButton.set_width_chars

    def set_width_chars(n_chars)
n_chars :the width in characters for the button

Note

This method is available in PyGTK 2.6 and above.

The set_width_chars() method sets the "width-chars" property to the value of n_chars. The "width-chars" property contains the width in characters that the button should be set to.