Callbacks¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- Gtk.AssistantPageFunc(current_page, *data)¶
- Parameters:
- Returns:
The next page number
- Return type:
Type of callback used to calculate the next page in a
GtkAssistant.It’s called both for computing the next page when the user presses the “forward” button and for handling the behavior of the “last” button.
See [method`Gtk`.Assistant.set_forward_page_func].
- Gtk.CellAllocCallback(renderer, cell_area, cell_background, *data)¶
- Parameters:
renderer (
Gtk.CellRenderer) – the cell renderer to operate oncell_area (
Gdk.Rectangle) – the area allocated to renderer inside the rectangle provided toGtk.CellArea.foreach_alloc().cell_background (
Gdk.Rectangle) – the background area for renderer inside the background area provided toGtk.CellArea.foreach_alloc().
- Returns:
Trueto stop iterating over cells.- Return type:
The type of the callback functions used for iterating over the cell renderers and their allocated areas inside a
GtkCellArea, seeGtk.CellArea.foreach_alloc().Deprecated since version 4.20: There is no replacement
- Gtk.CellCallback(renderer, *data)¶
- Parameters:
renderer (
Gtk.CellRenderer) – the cell renderer to operate on
- Returns:
Trueto stop iterating over cells.- Return type:
The type of the callback functions used for iterating over the cell renderers of a
GtkCellArea, seeGtk.CellArea.foreach().Deprecated since version 4.20: There is no replacement
- Gtk.CellLayoutDataFunc(cell_layout, cell, tree_model, iter, *data)¶
- Parameters:
cell_layout (
Gtk.CellLayout) – aGtkCellLayoutcell (
Gtk.CellRenderer) – the cell renderer whose value is to be settree_model (
Gtk.TreeModel) – the modeliter (
Gtk.TreeIter) – aGtkTreeIterindicating the row to set the value fordata (
objectorNone) – user data passed toGtk.CellLayout.set_cell_data_func()
A function which should set the value of cell_layout’s cell renderer(s) as appropriate.
Deprecated since version 4.20: There is no replacement
- Gtk.CustomAllocateFunc(widget, width, height, baseline)¶
- Parameters:
widget (
Gtk.Widget) – the widget to allocatewidth (
int) – the new width of the widgetheight (
int) – the new height of the widgetbaseline (
int) – the new baseline of the widget, or -1
A function to be used by
GtkCustomLayoutto allocate a widget.
- Gtk.CustomFilterFunc(item, *user_data)¶
- Parameters:
item (
GObject.Object) – the item to be matched
- Returns:
true to keep the item around
- Return type:
User function that is called to determine if the item should be matched.
If the filter matches the item, this function must return true. If the item should be filtered out, false must be returned.
- Gtk.CustomMeasureFunc(widget, orientation, for_size)¶
- Parameters:
widget (
Gtk.Widget) – the widget to be measuredorientation (
Gtk.Orientation) – the direction to be measuredfor_size (
int) – the size to be measured for
- Returns:
- minimum:
the measured minimum size of the widget
- natural:
the measured natural size of the widget
- minimum_baseline:
the measured minimum baseline of the widget
- natural_baseline:
the measured natural baseline of the widget
- Return type:
(minimum:
int, natural:int, minimum_baseline:int, natural_baseline:int)
A function to be used by
GtkCustomLayoutto measure a widget.
- Gtk.CustomRequestModeFunc(widget)¶
- Parameters:
widget (
Gtk.Widget) – the widget to be queried- Returns:
the size request mode
- Return type:
Queries a widget for its preferred size request mode.
- Gtk.DrawingAreaDrawFunc(drawing_area, cr, width, height, *user_data)¶
- Parameters:
drawing_area (
Gtk.DrawingArea) – theGtkDrawingAreato redrawcr (
cairo.Context) – the context to draw towidth (
int) – the actual width of the contents. This value will be at least as wide asGtk.DrawingArea:width.height (
int) – the actual height of the contents. This value will be at least as wide asGtk.DrawingArea:height.
Whenever drawing_area needs to redraw, this function will be called.
This function should exclusively redraw the contents of the drawing area and must not call any widget functions that cause changes.
- Gtk.EntryCompletionMatchFunc(completion, key, iter, *user_data)¶
- Parameters:
completion (
Gtk.EntryCompletion) – theGtkEntryCompletionkey (
str) – the string to match, normalized and case-foldediter (
Gtk.TreeIter) – aGtkTreeIterindicating the row to matchuser_data (
objectorNone) – user data given toGtk.EntryCompletion.set_match_func()
- Returns:
Trueif iter should be displayed as a possible completion for key- Return type:
A function which decides whether the row indicated by iter matches a given key, and should be displayed as a possible completion for key.
Note that key is normalized and case-folded (see
GLib.utf8_normalize() andGLib.utf8_casefold()). If this is not appropriate, match functions have access to the unmodified key viagtk_editable_get_text (GTK_EDITABLE (gtk_entry_completion_get_entry ())).Deprecated since version 4.20: There is no replacement
- Gtk.ExpressionNotify(*user_data)¶
- Parameters:
user_data (
objectorNone) – data passed toGtk.Expression.watch()
Callback called by
Gtk.Expression.watch() when the expression value changes.
- Gtk.FlowBoxCreateWidgetFunc(item, *user_data)¶
- Parameters:
item (
GObject.Object) – the item from the model for which to create a widget foruser_data (
objectorNone) – user data fromGtk.FlowBox.bind_model()
- Returns:
a
GtkWidgetthat represents item- Return type:
Called for flow boxes that are bound to a
GListModel.This function is called for each item that gets added to the model.
- Gtk.FlowBoxFilterFunc(child, *user_data)¶
- Parameters:
child (
Gtk.FlowBoxChild) – aGtkFlowBoxChildthat may be filtered
- Returns:
- Return type:
A function that will be called whenever a child changes or is added.
It lets you control if the child should be visible or not.
- Gtk.FlowBoxForeachFunc(box, child, *user_data)¶
- Parameters:
box (
Gtk.FlowBox) – aGtkFlowBoxchild (
Gtk.FlowBoxChild) – aGtkFlowBoxChild
A function used by
Gtk.FlowBox.selected_foreach().It will be called on every selected child of the box.
- Gtk.FlowBoxSortFunc(child1, child2, *user_data)¶
- Parameters:
child1 (
Gtk.FlowBoxChild) – the first childchild2 (
Gtk.FlowBoxChild) – the second child
- Returns:
< 0 if child1 should be before child2, 0 if they are equal, and > 0 otherwise
- Return type:
A function to compare two children to determine which should come first.
- Gtk.FontFilterFunc(family, face, *data)¶
- Parameters:
family (
Pango.FontFamily) – aPangoFontFamilyface (
Pango.FontFace) – aPangoFontFacebelonging to familydata (
objectorNone) – user data passed toGtk.FontChooser.set_filter_func()
- Returns:
Trueif the font should be displayed- Return type:
The type of function that is used for deciding what fonts get shown in a
GtkFontChooser.See [method`Gtk`.FontChooser.set_filter_func].
Deprecated since version 4.20: There is no replacement
- Gtk.IconViewForeachFunc(icon_view, path, *data)¶
- Parameters:
icon_view (
Gtk.IconView) – aGtkIconViewpath (
Gtk.TreePath) – TheGtkTreePathof a selected row
A function used by
Gtk.IconView.selected_foreach() to map all selected rows.It will be called on every selected row in the view.
Deprecated since version 4.20: There is no replacement.
- Gtk.ListBoxCreateWidgetFunc(item, *user_data)¶
- Parameters:
item (
GObject.Object) – the item from the model for which to create a widget for
- Returns:
a
GtkWidgetthat represents item- Return type:
Called for list boxes that are bound to a
GListModelwithGtk.ListBox.bind_model() for each item that gets added to the model.If the widget returned is not a
Gtk.ListBoxRowwidget, then the widget will be inserted as the child of an intermediateGtk.ListBoxRow.
- Gtk.ListBoxFilterFunc(row, *user_data)¶
- Parameters:
row (
Gtk.ListBoxRow) – the row that may be filtered
- Returns:
- Return type:
Will be called whenever the row changes or is added and lets you control if the row should be visible or not.
- Gtk.ListBoxForeachFunc(box, row, *user_data)¶
- Parameters:
box (
Gtk.ListBox) – aGtkListBoxrow (
Gtk.ListBoxRow) – aGtkListBoxRow
A function used by
Gtk.ListBox.selected_foreach().It will be called on every selected child of the box.
- Gtk.ListBoxSortFunc(row1, row2, *user_data)¶
- Parameters:
row1 (
Gtk.ListBoxRow) – the first rowrow2 (
Gtk.ListBoxRow) – the second row
- Returns:
< 0 if row1 should be before row2, 0 if they are equal and > 0 otherwise
- Return type:
Compare two rows to determine which should be first.
- Gtk.ListBoxUpdateHeaderFunc(row, before, *user_data)¶
- Parameters:
row (
Gtk.ListBoxRow) – the row to updatebefore (
Gtk.ListBoxRoworNone) – the row before row, orNoneif it is first
Whenever row changes or which row is before row changes this is called, which lets you update the header on row.
You may remove or set a new one via [method`Gtk`.ListBoxRow.set_header] or just change the state of the current header widget.
- Gtk.MapListModelMapFunc(item, *user_data)¶
- Parameters:
item (
GObject.Object) – The item to map
- Returns:
The item to map to
- Return type:
User function that is called to map an item of the original model to an item expected by the map model.
The returned items must conform to the item type of the model they are used with.
- Gtk.MenuButtonCreatePopupFunc(menu_button, *user_data)¶
- Parameters:
menu_button (
Gtk.MenuButton) – theGtkMenuButtonuser_data (
objectorNone) – User data passed toGtk.MenuButton.set_create_popup_func()
User-provided callback function to create a popup for a
GtkMenuButtonon demand.This function is called when the popup of menu_button is shown, but none has been provided via [method`Gtk`.MenuButton.set_popover] or [method`Gtk`.MenuButton.set_menu_model].
- Gtk.PageSetupDoneFunc(page_setup, *data)¶
- Parameters:
page_setup (
Gtk.PageSetup) – theGtkPageSetupthat has been passed toGtk.print_run_page_setup_dialog_async()data (
objectorNone) – user data that has been passed toGtk.print_run_page_setup_dialog_async()
The type of function that is passed to
Gtk.print_run_page_setup_dialog_async().This function will be called when the page setup dialog is dismissed, and also serves as destroy notify for data.
- Gtk.PrintJobCompleteFunc(print_job, user_data, error)¶
- Parameters:
print_job (
Gtk.PrintJob) – theGtkPrintJobuser_data (
objectorNone) – user data that has been passed toGtk.PrintJob.send()error (
GLib.Error) – aGErrorthat contains error information if the sending of the print job failed, otherwiseNone
The type of callback that is passed to
Gtk.PrintJob.send().It is called when the print job has been completely sent.
- Gtk.PrintSettingsFunc(key, value, *user_data)¶
- Parameters:
Function called by [method`Gtk`.PrintSettings.foreach] on every key/value pair inside a [class`Gtk`.PrintSettings].
- Gtk.PrinterFunc(printer, *data)¶
- Parameters:
printer (
Gtk.Printer) – aGtkPrinterdata (
objectorNone) – user data passed toGtk.enumerate_printers()
- Returns:
- Return type:
The type of function passed to
Gtk.enumerate_printers().Note that you need to ref printer, if you want to keep a reference to it after the function has returned.
- Gtk.ScaleFormatValueFunc(scale, value, *user_data)¶
- Parameters:
- Returns:
A newly allocated string describing a textual representation of the given numerical value.
- Return type:
Function that formats the value of a scale.
See [method`Gtk`.Scale.set_format_value_func].
- Gtk.ShortcutFunc(widget, args, *user_data)¶
- Parameters:
widget (
Gtk.Widget) – The widget passed to the activationargs (
GLib.VariantorNone) – The arguments passed to the activationuser_data (
objectorNone) – The user data provided when activating the action
- Returns:
true if the action was successful
- Return type:
Type for shortcuts based on user callbacks.
- Gtk.TextBufferCommitNotify(buffer, flags, position, length, *user_data)¶
- Parameters:
buffer (
Gtk.TextBuffer) – the text buffer being notifiedflags (
Gtk.TextBufferNotifyFlags) – the type of commit notificationposition (
int) – the position of the text operationlength (
int) – the length of the text operation in charactersuser_data (
objectorNone) – user data passed to the callback
A notification callback used by [method`Gtk`.TextBuffer.add_commit_notify].
You may not modify the [class`Gtk`.TextBuffer] from a [callback`Gtk`.TextBufferCommitNotify] callback and that is enforced by the [class`Gtk`.TextBuffer] API.
[callback`Gtk`.TextBufferCommitNotify] may be used to be notified about changes to the underlying buffer right before-or-after the changes are committed to the underlying B-Tree. This is useful if you want to observe changes to the buffer without other signal handlers potentially modifying state on the way to the default signal handler.
When flags is
GTK_TEXT_BUFFER_NOTIFY_BEFORE_INSERT,positionis set to the offset in characters from the start of the buffer where the insertion will occur.lengthis set to the number of characters to be inserted. You may not yet retrieve the text until it has been inserted. You may access the text fromGTK_TEXT_BUFFER_NOTIFY_AFTER_INSERTusing [method`Gtk`.TextBuffer.get_slice].When flags is
GTK_TEXT_BUFFER_NOTIFY_AFTER_INSERT,positionis set to offset in characters where the insertion occurred andlengthis set to the number of characters inserted.When flags is
GTK_TEXT_BUFFER_NOTIFY_BEFORE_DELETE,positionis set to offset in characters where the deletion will occur andlengthis set to the number of characters that will be removed. You may still retrieve the text from this handler usingpositionandlength.When flags is
GTK_TEXT_BUFFER_NOTIFY_AFTER_DELETE,lengthis set to zero to denote that the delete-range has already been committed to the underlying B-Tree. You may no longer retrieve the text that has been deleted from the [class`Gtk`.TextBuffer].New in version 4.16.
- Gtk.TextCharPredicate(ch, *user_data)¶
- Parameters:
- Returns:
Trueif the predicate is satisfied, and the iteration should stop, andFalseotherwise- Return type:
The predicate function used by
Gtk.TextIter.forward_find_char() andGtk.TextIter.backward_find_char().
- Gtk.TextTagTableForeach(tag, *data)¶
- Parameters:
tag (
Gtk.TextTag) – theGtkTextTagdata (
objectorNone) – data passed toGtk.TextTagTable.foreach()
A function used with
Gtk.TextTagTable.foreach(), to iterate over everyGtkTextTaginside aGtkTextTagTable.
- Gtk.TickCallback(widget, frame_clock, *user_data)¶
- Parameters:
widget (
Gtk.Widget) – the widgetframe_clock (
Gdk.FrameClock) – the frame clock for the widgetuser_data (
objectorNone) – user data passed to [method`Gtk`.Widget.add_tick_callback].
- Returns:
G_SOURCE_CONTINUEif the tick callback should continue to be called,G_SOURCE_REMOVEif it should be removed- Return type:
Callback type for adding a function to update animations.
See [method`Gtk`.Widget.add_tick_callback].
- Gtk.TreeCellDataFunc(tree_column, cell, tree_model, iter, *data)¶
- Parameters:
tree_column (
Gtk.TreeViewColumn) – AGtkTreeViewColumncell (
Gtk.CellRenderer) – TheGtkCellRendererthat is being rendered by tree_columntree_model (
Gtk.TreeModel) – TheGtkTreeModelbeing renderediter (
Gtk.TreeIter) – AGtkTreeIterof the current row rendered
A function to set the properties of a cell instead of just using the straight mapping between the cell and the model.
This function is useful for customizing the cell renderer. For example, a function might get an* integer from the tree_model, and render it to the “text” attribute of “cell” by converting it to its written equivalent.
See also:
Gtk.TreeViewColumn.set_cell_data_func()Deprecated since version 4.20: There is no replacement
- Gtk.TreeIterCompareFunc(model, a, b, *user_data)¶
- Parameters:
model (
Gtk.TreeModel) – TheGtkTreeModelthe comparison is withina (
Gtk.TreeIter) – AGtkTreeIterin modelb (
Gtk.TreeIter) – AnotherGtkTreeIterin modeluser_data (
objectorNone) – Data passed when the compare func is assigned e.g. byGtk.TreeSortable.set_sort_func()
- Returns:
a negative integer, zero or a positive integer depending on whether a sorts before, with or after b
- Return type:
A
Gtk.TreeIterCompareFuncshould return a negative integer, zero, or a positive integer if a sorts before b, a sorts with b, or a sorts after b respectively.If two iters compare as equal, their order in the sorted model is undefined. In order to ensure that the
GtkTreeSortablebehaves as expected, theGtk.TreeIterCompareFuncmust define a partial order on the model, i.e. it must be reflexive, antisymmetric and transitive.For example, if model is a product catalogue, then a compare function for the “price” column could be one which returns
price_of(@a) - price_of(@b).Deprecated since version 4.20: There is no replacement
- Gtk.TreeListModelCreateModelFunc(item, *user_data)¶
- Parameters:
item (
GObject.Object) – The item that is being expandeduser_data (
objectorNone) – User data passed when registering the function
- Returns:
The model tracking the children of item or
Noneif item can never have children- Return type:
Prototype of the function called to create new child models when
Gtk.TreeListRow.set_expanded() is called.This function can return
Noneto indicate that item is guaranteed to be a leaf node and will never have children. If it does not have children but may get children later, it should return an empty model that is filled once children arrive.
- Gtk.TreeModelFilterModifyFunc(model, iter, column, *data)¶
- Parameters:
model (
Gtk.TreeModel) – theGtkTreeModelFilteriter (
Gtk.TreeIter) – aGtkTreeIterpointing to the row whose display values are determinedcolumn (
int) – the column whose display value is determineddata (
objectorNone) – user data given toGtk.TreeModelFilter.set_modify_func()
- Returns:
A
GValuewhich is already initialized for with the correct type for the column column.- Return type:
value:
GObject.Value
A function which calculates display values from raw values in the model. It must fill value with the display value for the column column in the row indicated by iter.
Since this function is called for each data access, it’s not a particularly efficient operation.
Deprecated since version 4.20: There is no replacement
- Gtk.TreeModelFilterVisibleFunc(model, iter, *data)¶
- Parameters:
model (
Gtk.TreeModel) – the child model of theGtkTreeModelFilteriter (
Gtk.TreeIter) – aGtkTreeIterpointing to the row in model whose visibility is determineddata (
objectorNone) – user data given toGtk.TreeModelFilter.set_visible_func()
- Returns:
Whether the row indicated by iter is visible.
- Return type:
A function which decides whether the row indicated by iter is visible.
Deprecated since version 4.20: There is no replacement
- Gtk.TreeModelForeachFunc(model, path, iter, *data)¶
- Parameters:
model (
Gtk.TreeModel) – theGtkTreeModelbeing iteratedpath (
Gtk.TreePath) – the currentGtkTreePathiter (
Gtk.TreeIter) – the currentGtkTreeIterdata (
objectorNone) – The user data passed toGtk.TreeModel.foreach()
- Returns:
- Return type:
Type of the callback passed to
Gtk.TreeModel.foreach() to iterate over the rows in a tree model.Deprecated since version 4.20: There is no replacement.
- Gtk.TreeSelectionForeachFunc(model, path, iter, *data)¶
- Parameters:
model (
Gtk.TreeModel) – TheGtkTreeModelbeing viewedpath (
Gtk.TreePath) – TheGtkTreePathof a selected rowiter (
Gtk.TreeIter) – AGtkTreeIterpointing to a selected row
A function used by
Gtk.TreeSelection.selected_foreach() to map all selected rows. It will be called on every selected row in the view.Deprecated since version 4.20: There is no replacement
- Gtk.TreeSelectionFunc(selection, model, path, path_currently_selected, *data)¶
- Parameters:
selection (
Gtk.TreeSelection) – AGtkTreeSelectionmodel (
Gtk.TreeModel) – AGtkTreeModelbeing viewedpath (
Gtk.TreePath) – TheGtkTreePathof the row in questionpath_currently_selected (
bool) –True, if the path is currently selected
- Returns:
True, if the selection state of the row can be toggled- Return type:
A function used by
Gtk.TreeSelection.set_select_function() to filter whether or not a row may be selected. It is called whenever a row’s state might change.A return value of
Trueindicates to selection that it is okay to change the selection.Deprecated since version 4.20: There is no replacement
- Gtk.TreeViewColumnDropFunc(tree_view, column, prev_column, next_column, *data)¶
- Parameters:
tree_view (
Gtk.TreeView) – AGtkTreeViewcolumn (
Gtk.TreeViewColumn) – TheGtkTreeViewColumnbeing draggedprev_column (
Gtk.TreeViewColumn) – AGtkTreeViewColumnon one side of columnnext_column (
Gtk.TreeViewColumn) – AGtkTreeViewColumnon the other side of column
- Returns:
True, if column can be dropped in this spot- Return type:
Function type for determining whether column can be dropped in a particular spot (as determined by prev_column and next_column). In left to right locales, prev_column is on the left of the potential drop spot, and next_column is on the right. In right to left mode, this is reversed. This function should return
Trueif the spot is a valid drop spot. Please note that returningTruedoes not actually indicate that the column drop was made, but is meant only to indicate a possible drop spot to the user.Deprecated since version 4.20: There is no replacement.
- Gtk.TreeViewMappingFunc(tree_view, path, *user_data)¶
- Parameters:
tree_view (
Gtk.TreeView) – AGtkTreeViewpath (
Gtk.TreePath) – The path that’s expanded
Function used for
Gtk.TreeView.map_expanded_rows().Deprecated since version 4.20: There is no replacement.
- Gtk.TreeViewRowSeparatorFunc(model, iter, *data)¶
- Parameters:
model (
Gtk.TreeModel) – theGtkTreeModeliter (
Gtk.TreeIter) – aGtkTreeIterpointing at a row in model
- Returns:
Trueif the row is a separator- Return type:
Function type for determining whether the row pointed to by iter should be rendered as a separator. A common way to implement this is to have a boolean column in the model, whose values the
GtkTreeViewRowSeparatorFuncreturns.Deprecated since version 4.20: There is no replacement.
- Gtk.TreeViewSearchEqualFunc(model, column, key, iter, *search_data)¶
- Parameters:
model (
Gtk.TreeModel) – theGtkTreeModelbeing searchedcolumn (
int) – the search column set byGtk.TreeView.set_search_column()key (
str) – the key string to compare withiter (
Gtk.TreeIter) – aGtkTreeIterpointing the row of model that should be compared with key.search_data (
objectorNone) – user data fromGtk.TreeView.set_search_equal_func()
- Returns:
- Return type:
A function used for checking whether a row in model matches a search key string entered by the user. Note the return value is reversed from what you would normally expect, though it has some similarity to strcmp() returning 0 for equal strings.
Deprecated since version 4.20: There is no replacement.
- Gtk.WidgetActionActivateFunc(widget, action_name, parameter)¶
- Parameters:
widget (
Gtk.Widget) – the widget to which the action belongsaction_name (
str) – the action nameparameter (
GLib.VariantorNone) – parameter for activation
The type of the callback functions used for activating actions installed with [method`Gtk`.WidgetClass.install_action].
The parameter must match the parameter_type of the action.