manpagez: man pages & more
html files: pygtk
Home | html | info | man
): def get_delay_time()
def get_pixbuf()
def on_currently_loading_frame()
def advance(current_time=0.0)

Ancestry

+-- gobject.GObject
  +-- gtk.gdk.PixbufAnimationIter

Description

A gtk.gdk.PixbufAnimationIter is used to access the frames of a gtk.gdk.PixbufAnimation at specified times. A gtk.gdk.PixbufAnimationIter object is created using the gtk.gdk.PixbufAnimation.get_iter() method. After creating an iterator, you should immediately display the pixbuf returned by the get_pixbuf() method. Then, you should install a timeout (with the gobject.timeout_add()() function) or by some other mechanism ensure that you'll update the image after the number of milliseconds specified by the get_delay_time() method. Each time the image is updated, you should reinstall the timeout with the new, possibly-changed delay time.

To update the image (i.e. possibly change the result of the get_pixbuf() method to a new frame of the animation), call the advance() method.

If you're using a gtk.gdk.PixbufLoader, in addition to updating the image after the delay time, you should also update it whenever you receive the "area_updated" signal and the on_currently_loading_frame() method returns True. In this case, the frame currently being fed into the loader has received new data, so needs to be refreshed. The delay time for a frame may also be modified after an "area_updated" signal, for example if the delay time for a frame is encoded in the data after the frame itself. So your timeout should be reinstalled after any area_updated signal. A delay time of -1 is possible, indicating "infinite."

Methods

gtk.gdk.PixbufAnimationIter.get_delay_time

    def get_delay_time()

Returns :

the delay time in milliseconds (thousandths of a second)

The get_delay_time() method returns the number of milliseconds the current pixbuf should be displayed, or -1 if the current pixbuf should be displayed forever. The gobject.timeout_add()() function conveniently takes a timeout in milliseconds, so you can use a timeout to schedule the next update.

gtk.gdk.PixbufAnimationIter.get_pixbuf

    def get_pixbuf()

Returns :

the current gtk.gdk.Pixbuf to be displayed

The get_pixbuf() method returns the current gtk.gdk.Pixbuf that should be displayed. The pixbuf will be the same size as the animation itself (see the gtk.gdk.PixbufAnimation.get_width() and gtk.gdk.PixbufAnimation.get_height() methods). The gtk.gdk.Pixbuf should be displayed for the number of milliseconds specified by the get_delay_time() method.

gtk.gdk.PixbufAnimationIter.on_currently_loading_frame

    def on_currently_loading_frame()

Returns :

True if the frame we're on is partially loaded, or the last frame

The on_currently_loading_frame() method returns True if the frame currently pointed to by the iterator is partially loaded or the last frame. This method is used to determine how to respond to the "area_updated" signal on gtk.gdk.PixbufLoader when loading an animation. The "area_updated" signal is emitted for an area of the frame currently streaming in to the loader. So if you're on the currently loading frame, you need to redraw the screen for the updated area.

gtk.gdk.PixbufAnimationIter.advance

    def advance(current_time=0.0)

current_time :

the current time as a float or 0.0 to automatically determine the current time

Returns :

True if the image may need updating

The advance() method attempts to advance an animation to a new frame. The frame is chosen based on the start time passed to the gtk.gdk.PixbufAnimation.get_iter() method. current_time is normally the current time (as specified by the Python time.time() function) and must be greater than or equal to the time passed to the gtk.gdk.PixbufAnimation.get_iter() method, and must increase or remain unchanged each time the get_pixbuf() method is called. That is, you can't go backward in time; animations only play forward. As a shortcut, pass 0.0 (the default) for the current time and the current time will automatically be determined an used. So you only need to explicitly pass current_time if you're doing something odd like playing the animation at double speed.

If this method returns False, there's no need to update the animation display, assuming the display had been rendered prior to advancing; if True, you need to call the get_pixbuf() method and update the display with the new pixbuf.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.