[pygtk] Updating image without closing window
DINESHBABU DINAKARABABU
dinesh243 at gmail.com
Thu Aug 6 01:25:07 WST 2009
Hi,
I tried it. But, I need to do a key press for closing the first image and
view the next image and so on. I am on the lookout for some method which
opens and displays the first image, once the pixbuf gets updated, the first
image closes and gets replaced by the next image and so on. I need
successive display of images with the pixbuf updating without any manual
intervention.
I really appreciate you taking the time and providing the suggestions. It
has been really helpful.
Thanks a ton.
On Wed, Aug 5, 2009 at 3:01 AM, Timo <timomlists at gmail.com> wrote:
> DINESHBABU DINAKARABABU schreef:
>
>> I found out that widget.queue_draw() should solve the issue. But, I am
>> still having doubts on how to use the queue_draw() method.
>> It would be great if someone could let me know on how to use the method in
>> my 'expose' function and bind it to the "expose_event". My expose function
>> is defined as follows:
>>
>> def expose (da, event, pixbuf):
>> ctx = da.window.cairo_create()
>> ctx.set_source_pixbuf(pixbuf,0,0)
>> ctx.paint()
>> ctx.stroke()
>>
> Add this line here:
> da.queue_draw()
>
>
>> It would be extremely helpful if someone could guide me in this regard. I
>> really appreciate the help.
>>
>> Thanks
>>
>> On Tue, Aug 4, 2009 at 10:48 AM, DINESHBABU DINAKARABABU <
>> dinesh243 at gmail.com <mailto:dinesh243 at gmail.com>> wrote:
>>
>> 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
>>
>>
>>
>>
>> --
>> Cheers
>> DB
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> pygtk mailing list pygtk at daa.com.au
>> http://www.daa.com.au/mailman/listinfo/pygtk
>> Read the PyGTK FAQ: http://faq.pygtk.org/
>>
>
>
--
Cheers
DB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090805/0697a28f/attachment.htm
More information about the pygtk
mailing list