Package: gtk

Function gtk-widget-add-tick-callback

Lambda List

gtk-widget-add-tick-callback (widget func)

Arguments

widget -- a gtk-widget object
func -- a gtk-tick-callback callback function to call for updating animations

Return Value

An unsigned integer ID for the connection of this callback function, remove the callback function by passing it to the gtk-widget-remove-tick-callback function.

Details

Queues an animation frame update and adds a callback function to be called before each frame. Until the tick callback function 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, it is most suitable for handling graphics that change every frame or every few frames. The tick callback function does not automatically imply a relayout or repaint. If you want a repaint or relayout, and are not changing widget properties that would trigger that, for example, changing the text of a gtk-label widget, then you will have to call the gtk-widget-queue-resize function or the gtk-widget-queue-draw-area function yourself.

The gdk-frame-clock-frame-time function should generally be used for timing continuous animations and the gdk-frame-timings-predicted-presentation-time function if you are trying to display isolated frames at particular times.

This is a more convenient alternative to connecting directly to the "update" signal of the gdk-frame-clock object, since you do not have to worry about when the gdk-frame-clock object is assigned to a widget.
 

See also

2021-9-16