Re: Grab a pixmap / screenshot thing



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




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