The diary of a dedicated Ubuntu user that lucked into his dream job working on the Ubuntu team.

Saturday, January 16, 2010

Tonight's Photobomb Feature: WebCam Support

Last week Seb128 uploaded pygame 1.9.1 to Lucid universe. This was great for me, because pygame 1.9 has fun and easy webcam support.

So today, while lying around recovering from a bit of jet lag, I created a widget that wraps up the pygame webcam support with pygtk. So the contents of the Web Cam tab in the screen shot above is actually from Quidgets, quidgets.widgets.CameraButton. (probably not the best name, but it when I started it, it was just a button that you clicked on, without other controls.

3. Respond to picture_taken events and use the supplied pixbuf. So really, it's about 3 lines of code to get web cam support set up with quidgets.

After you have the pixbuf from the camera, you are on your own to do with it what you will. For me, it was easy, as already had code for handling pixbufs read from the disk, so I just needed to do a bit of refactoring and it worked without new code.

It's fresh, barely tested, code. You can get it from the trunk if you want to play with it.