Re: Grab a pixmap / screenshot thing



On Tue, 07 Nov 2006 19:00:03 +0100
Torsten Schoenfeld <kaffeetisch gmx de> wrote:

On Tue, 2006-11-07 at 10:08 +1100, Daniel Kasak wrote:
Is it possible to create a pixmap of the current desktop ... or part of 
it ... using gtk2-perl?

Get the Gtk2::Gdk::Window for the root window.  Create a pixbuf from it.
Save the pixbuf to disk.

 use Gtk2 -init;
 my $s = Gtk2::Gdk::Screen->get_default;
 my $w = $s->get_root_window;
 my $p = Gtk2::Gdk::Pixbuf->get_from_drawable (
           $w, undef, 0, 0, 0, 0, $s->get_width, $s->get_height);
 $p->save ("screenshot.png", "png");'

I don't know if that works on anything but X11, though.

-- 
Bye,
-Torsten

Thats cool.  Lightbulb goes on!!!  
I wonder if it can be used in a thread, to take a series of screenshots thru a timer,
which can then be assembled into an mpg movie of the screen action. ?

zentara



-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]