[pygtk] Updating image without closing window

DINESHBABU DINAKARABABU dinesh243 at gmail.com
Wed Aug 5 01:48:54 WST 2009


Hi all,

I am writing a program to continuously display full screen images after
getting the raw image data from a remote machine. (Doing it using sockets).
It would be really helpful if any one of you could help me out in solving
the issue as I am pretty new to Python and PyGTK.

I am able to get the first image image on the screen. But, not the remaining
images. Is there anyway to display the images successively without actually
closing the window? In other words, is it possible to just update the first
image with the update of the raw image data?

My image display code is as below. I stop with the image displays once I
receive a flag = 1 from my remote machine.
def main():
 flag = 0
 while flag == 0:
    imagedata = conn.recv(1024)
    flag = conn.recv(2)
    pixbuf = gtk.gdk.pixbuf_new_from_data(imagedata, gtk.gdk.COLORSPACE_RGB,
0, 8, 480, 320, 1440)
    imgw=pixbuf.get_width()
    imgh=pixbuf.get_height()
    win = gtk.Window()
    pixmap = gtk.gdk.Pixmap(None, 1, 1, 1)
    color = gtk.gdk.Color()
    cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0)
    gtk.Window.fullscreen(win)
    win.connect("realize", lambda obj: win.window.set_cursor(cursor))
    win.connect("key-press-event", key_press_event)
    win.connect('destroy', gtk.main_quit)
    win.set_default_size(imgw, imgh)
    da = gtk.DrawingArea()
    win.add(da)
    da.connect('expose_event', expose, pixbuf)
    win.show_all()
 gtk.main()

I would be grateful if any one can give me any suggestions on how to go
about solving the problem. I would really appreciate any help. Thanks a lot
in advance.

-- 
Cheers
DB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090804/d0f4ec73/attachment.htm 


More information about the pygtk mailing list