### Method

# Gtk Widget add_tick_callback

#### Declaration [src]

    guint
    gtk_widget_add_tick_callback (
      GtkWidget* widget,
      GtkTickCallback callback,
      gpointer user_data,
      GDestroyNotify notify
    )

#### Description [src]

Queues an animation frame update and adds a callback to be called before each frame.

Until the tick callback is removed, it will be called frequently (usually at the frame rate of the output device or as quickly as the application can be repainted, whichever is slower). For this reason, is most suitable for handling graphics that change every frame or every few frames.

The tick callback does not automatically imply a relayout or repaint. If you want a repaint or relayout, and aren’t changing widget properties that would trigger that (for example, changing the text of a label), then you will have to call `gtk_widget_queue_resize()` or `gtk_widget_queue_draw()` yourself.

`gdk_frame_clock_get_frame_time()` should generally be used for timing continuous animations and `gdk_frame_timings_get_predicted_presentation_time()` should be used if you are trying to display isolated frames at particular times.

This is a more convenient alternative to connecting directly to the `GdkFrameClock::update` signal of the frame clock, since you don’t have to worry about when a frame clock is assigned to a widget.

To remove a tick callback, pass the ID that is returned by this function to `gtk_widget_remove_tick_callback()`.

#### Parameters

`callback`

  Type: `GtkTickCallback`

  Function to call for updating animations.

`user_data`

  Type: `gpointer`

  Data to pass to `callback`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`notify`

  Type: `GDestroyNotify`

  Function to call to free `user_data`.

#### Return value

Type: `guint`

An ID for this callback.