Hi all,

I'm having trouble writing a simple image viewer using PyGtk and Imlib.  I
can load the first image fine, but I don't know how to display the second
image into the first pixmap without creating and showing a completely new
Pixmap widget for it (thus causing terrible flicker as the widget is erased
and redrawn).  From reading the source, I see that the GtkPixmap.set()
method might be what I want, but I can't get it to work.

Here's what I'm trying:

def next(window, event):
     img2 = GdkImlib.Image('page02.gif')
     img2.render()
     pix2 = img2.make_pixmap()
     pix = window.get_data('user_data')
     pix.set(pix2, None)

def main():
     window = gtk.GtkWindow()
     window.connect('key_press_event', next)
     img = GdkImlib.Image('page01.gif')
     img.render()
     pix = img.make_pixmap()
     window.set_data('user_data', pix)
     window.add(pix)
     pix.show()
     window.show()

     gtk.mainloop()

And this is the error I get:

Traceback (innermost last):
  File "/usr/lib/python1.5/site-packages/gtk.py", line 125, in __call__
    ret = apply(self.func, a)
  File "../test.py", line 11, in next
    pix.set(pix2, None)
  File "/usr/lib/python1.5/site-packages/gtk.py", line 2225, in set
    _gtk.gtk_pixmap_set(self._o, pixmap, mask)
TypeError: gtk_pixmap_set, argument 2: expected GdkWindow, instance found

Obviously I'm trying to use pix.set() incorrectly.  What's the right way?

Tessa Lau
[EMAIL PROTECTED]

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to