>>>>> "Alexandre" == Alexandre Strube <[EMAIL PROTECTED]> writes:

    Alexandre> The file "foo.png" is saved correctly, which means the
    Alexandre> capture stuff is ok. However, nothing shows up on
    Alexandre> "janela1". What am I doing wrong?

    Alexandre> Thanks for your help,

As Gustavo pointed out, you cannot draw until the window is realized.

Here is some template code for drawing

#!/usr/bin/env python
# this is meant to be used as a template file to practice drawing commands
import pygtk
pygtk.require('2.0')
import gtk
from gtk import gdk

def draw(widget):
    print 'draw'
    gc = widget.window.new_gc()
    widget.window.draw_rectangle( gc, 1, 100,100,100,100)
    
def configure_event(widget, event):
    print 'config'
    draw(widget)
    return gtk.TRUE

def expose_event(widget, event):
    print 'expose'
    draw(widget)
    return gtk.TRUE

def realize(widget):
    print 'realize'
    draw(widget)
    return gtk.TRUE

win = gtk.Window()
win.set_size_request(640, 480)
win.show()


vbox = gtk.VBox()
vbox.show()
win.add(vbox)

da = gtk.DrawingArea()
da.connect('configure_event', configure_event)
da.connect('expose_event', configure_event)
da.connect('realize', realize)
da.show()
vbox.pack_start(da, gtk.TRUE, gtk.TRUE)


button = gtk.Button('Quit')
button.show()
vbox.pack_start(button, gtk.FALSE, gtk.FALSE)
button.connect('clicked', gtk.mainquit)
gtk.mainloop()

You will probably want to connect your function which grabs a frame
and displays it when called to the gtk idle handler or timer,

Also, do you need to go through PIL?   Can you not do something like.

  widget.window.draw_rgb_image(gc, 1, 1, WIDTH, HEIGHT, 
       gtk.gdk.RGB_DITHER_NONE, vid.getImage(0), stride)

JDH
_______________________________________________
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