Gtk.FileChooserButton¶
Methods¶
| class | new(title, action) | 
| class | new_with_dialog(dialog) | 
| get_focus_on_click() | |
| get_title() | |
| get_width_chars() | |
| set_focus_on_click(focus_on_click) | |
| set_title(title) | |
| set_width_chars(n_chars) | 
Virtual Methods¶
| Inherited: | Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10) | 
|---|
| do_file_set() | 
Properties¶
| Inherited: | Gtk.Box (3), Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1), Gtk.FileChooser (11) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| dialog | Gtk.FileChooser | w/co | The file chooser dialog to use. | 
| title | str | r/w | The title of the file chooser dialog. | 
| width-chars | int | r/w | The desired width of the button widget, in characters. | 
Child Properties¶
| Inherited: | Gtk.Box (5) | 
|---|
Style Properties¶
| Inherited: | Gtk.Widget (17) | 
|---|
Signals¶
| Inherited: | Gtk.Container (4), Gtk.Widget (69), GObject.Object (1), Gtk.FileChooser (5) | 
|---|
| Name | Short Description | 
|---|---|
| file-set | The ::file-setsignal is emitted when the user selects a file. | 
Fields¶
| Inherited: | Gtk.Container (4), Gtk.Widget (69), GObject.Object (1), Gtk.FileChooser (5) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| parent | Gtk.Box | r | 
Class Details¶
- 
class Gtk.FileChooserButton(*args, **kwargs)¶
- Bases: - Gtk.Box,- Gtk.FileChooser- Abstract: - No - Structure: - Gtk.FileChooserButtonClass- The - Gtk.FileChooserButtonis a widget that lets the user select a file. It implements the- Gtk.FileChooserinterface. 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- Gtk.FileChooser- :select-multipleproperty to- True.- Create a button to let the user select a file in /etc
 - { GtkWidget *button; button = gtk_file_chooser_button_new (_("Select a file"), GTK_FILE_CHOOSER_ACTION_OPEN); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (button), "/etc"); } - The - Gtk.FileChooserButtonsupports the- Gtk.FileChooserActions- Gtk.FileChooserAction.OPENand- Gtk.FileChooserAction.SELECT_FOLDER.- The - Gtk.FileChooserButtonwill ellipsize the label, and will thus request little horizontal space. To give the button more space, you should call- Gtk.Widget.get_preferred_size(),- Gtk.FileChooserButton.set_width_chars(), or pack the button in such a way that other interface elements give space to the widget.- CSS nodes
 - Gtk.FileChooserButtonhas a CSS node with name “filechooserbutton”, containing a subnode for the internal button with name “button” and style class “.file”.- 
classmethod new(title, action)[source]¶
- Parameters: - title (str) – the title of the browse dialog.
- action (Gtk.FileChooserAction) – the open mode for the widget.
 - Returns: - a new button widget. - Return type: - Creates a new file-selecting button widget. - New in version 2.6. 
- title (
 - 
classmethod new_with_dialog(dialog)[source]¶
- Parameters: - dialog ( - Gtk.Dialog) – the widget to use as dialog- Returns: - a new button widget. - Return type: - Gtk.Widget- Creates a - Gtk.FileChooserButtonwidget which uses dialog as its file-picking window.- Note that dialog must be a - Gtk.Dialog(or subclass) which implements the- Gtk.FileChooserinterface and must not have- Gtk.DialogFlags.DESTROY_WITH_PARENTset.- Also note that the dialog needs to have its confirmative button added with response - Gtk.ResponseType.ACCEPTor- Gtk.ResponseType.OKin order for the button to take over the file selected in the dialog.- New in version 2.6. 
 - 
get_focus_on_click()[source]¶
- Returns: - Trueif the button grabs focus when it is clicked with the mouse.- Return type: - bool- Returns whether the button grabs focus when it is clicked with the mouse. See - Gtk.FileChooserButton.set_focus_on_click().- New in version 2.10. - Deprecated since version 3.20: Use - Gtk.Widget.get_focus_on_click() instead
 - 
get_title()[source]¶
- Returns: - a pointer to the browse dialog’s title. - Return type: - str- Retrieves the title of the browse dialog used by self. The returned value should not be modified or freed. - New in version 2.6. 
 - 
get_width_chars()[source]¶
- Returns: - an integer width (in characters) that the button will use to size itself. - Return type: - int- Retrieves the width in characters of the self widget’s entry and/or label. - New in version 2.6. 
 - 
set_focus_on_click(focus_on_click)[source]¶
- Parameters: - focus_on_click ( - bool) – whether the button grabs focus when clicked with the mouse- Sets whether the button will grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application. - New in version 2.10. - Deprecated since version 3.20: Use - Gtk.Widget.set_focus_on_click() instead
 - 
set_title(title)[source]¶
- Parameters: - title ( - str) – the new browse dialog title.- Modifies the title of the browse dialog used by self. - New in version 2.6. 
 - 
set_width_chars(n_chars)[source]¶
- Parameters: - n_chars ( - int) – the new width, in characters.- Sets the width (in characters) that self will use to n_chars. - New in version 2.6. 
 - 
do_file_set() virtual¶
 
Signal Details¶
- 
Gtk.FileChooserButton.signals.file_set(file_chooser_button)¶
- Signal Name: - file-set- Flags: - RUN_FIRST- Parameters: - file_chooser_button ( - Gtk.FileChooserButton) – The object which received the signal- The - ::file-setsignal is emitted when the user selects a file.- Note that this signal is only emitted when the user changes the file. - New in version 2.12. 
Property Details¶
- 
Gtk.FileChooserButton.props.dialog¶
- Name: - dialog- Type: - Gtk.FileChooser- Default Value: - None- Flags: - WRITABLE,- CONSTRUCT_ONLY- Instance of the - Gtk.FileChooserDialogassociated with the button.- New in version 2.6. 
- 
Gtk.FileChooserButton.props.title¶
- Name: - title- Type: - str- Default Value: - 'Select a File'- Flags: - READABLE,- WRITABLE- Title to put on the - Gtk.FileChooserDialogassociated with the button.- New in version 2.6. 
