On 09/05/2011 02:08 PM, eexpress wrote:
> #!/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不怕出事吗... >_<

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

回复