2011年9月6日星期二

Re: [PerlChina] Gtk在root窗口画图,不会取expose信号。

这例子,使用窗口的,和我的思路不同。root窗口明确的有expose事件的,就是奇怪,调用不到。GdkEventMask,我也强制开启并测试了。

不写use
strict不怕出事,lol,测试而已。其实也从来没出过问题。perl历来随手写。

在 Wed, 07 Sep 2011 08:48:05 +0800,snyh <snyh1010@gmail.com> 写道:

> 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 讨论组"论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

没有评论: