On Mon, 30 Oct 2000, Tessa Lau wrote:
>
> 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()
Use "pix2, mask = img2.get_pixmap()" here instead of
make_pixmap(). Make_pixmap returns a new GtkPixmap widget rather than a
GdkPixmap/GdkBitmap pair.
> pix = window.get_data('user_data')
> pix.set(pix2, None)
and then change this to "pix.set(pix2, mask)"
>
> 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?
James.
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk