#!/usr/bin/perl要直接画图到桌面上 参考这个吧
use Gtk2 "-init";
$file="$ENV{HOME}/tt.png";
Gtk2->init;
$screen=Gtk2::Gdk::Screen->get_default;
$window=$screen->get_root_window;
#$screen->broadcast_client_message(Gtk2::Gdk::Event->new("expose"));
#$window->signal_connect('expose_event', \&expose, $window);
$gc = Gtk2::Gdk::GC->new ($window, undef);
($real_drawable,$x_offset,$y_offset)=$window->get_internal_paint_info;
expose();
#Gtk2->main_iteration while Gtk2->events_pending;
Gtk2->main();
#Gtk2->main_iteration;
sub expose {
$pixbuf=Gtk2::Gdk::Pixbuf->new_from_file($file);
($format,$width,$height)=$pixbuf->get_file_info($file);
$pixbuf->render_to_drawable($real_drawable,$gc,0,0,100,100,$width,$height,'normal',0,0);
}
请人帮忙测试下,搞定啊。
画的图,都被擦除了。
http://gtk2-perl.sourceforge.net/doc/gtk2-perl-study-guide/x2176.html
你不 use strict不怕出事吗... >_<
没有评论:
发表评论