Hello list,

I'm trying to write a kind of webcam application in Python, using as
user interface a .glade file. Until there, nothing difficult.

My problem is with getting the data from the webcam and putting it to
screen. I can grab images from camera and save it to files, but I don't
know how to put it on a gtk widget.

I have a drawingArea widget, called "janela1". I'm receiving data from
video4linux to the variable "im", and converting this to a string again
for putting it on the window, as stated at
" http://www.daa.com.au/pipermail/pygtk/2004-January/006731.html "

The code follows:

  janela1=xml.get_widget('drawingarea1')  # gets drawingarea widget
  gc=janela1.window.new_gc()         # creates a new window context
  vid=inicializavideo()              # initializes video4linux stuff
  im=Image.fromstring("RGB",(WIDTH,HEIGHT),vid.getImage(0)) # grab image
  im.save("foo.png","PNG")                 # Saves image file (it works)
  buff=im.tostring()
  janela1.window.draw_rgb_image(gc, 1, 1, WIDTH, HEIGHT,
gtk.gdk.RGB_DITHER_NONE, buff)
  gtk.main()


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

Thanks for your help,

Alexandre Strube

_______________________________________________
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