On Sun, Sep 28, 2003 at 01:56:38PM -0300, alejandro david weil wrote:
> I have a bitmap that is the background, and something like-sprites to draw.
> I think that is better to draw sprites, in this way: draw them on a new frresh 
> bitmap than, remember what them have overwritten, draw that back and backup
> the area that will be overwritten, and then, draw the sprite.

I'm not sure this is the most efficient way to do animation in GTK+.
Have the gtk-app-devel people given you any good ideas?

> But now, It keeps being cpu consumer, I think that it's because is called
> from idle callback, all the time (althought it's not drawing every time). May
> be i must switch back to simple timeout callback instead of the idlebased.

I think the timeout callback is the correct way to go -- your idle hack
hasn't bought you anything, has it?

> Here's the 'callback' code.. i'll promise to send complete code when it
> be on a more.. decent state.  ( do you understand spanish ? )

No, I understand the code and your approach perfectly. However, I think
the real problem we're having is unrelated to the actual timeout process
-- your draw/redraw seems to be too expensive. For instance:

    >>> import gtk
    >>> def foo(*args):
    ...   print "CALLED"
    ...   return gtk.TRUE 
    ... 
    >>> gtk.timeout_add(30, foo)
    >>> gtk.mainloop()

Prints out a ton of CALLED messages, and yet the CPU usage never goes
up. 

So it's not a matter of the frequency of calls, but rather your drawing
that's too expensive. And I'm not the best person to advise you on
drawing, since I've only played with GtkDrawingArea once, and it wasn't
a pretty sight :-)

Take care,
--
Christian Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to