From: <be...@cu...> - 2001-09-25 23:55:05
|
Hello. I'm playing with GTK and Imlib in PERL (I'm new to windowing via PERL). One little thing is nagging me. Why is it that when I call an image open it closes immediately? Do I need to insert an infinite event loop that just keeps rendering the image? How do I keep the thing on the screen? Here's my script: #!/usr/bin/perl -w use Gtk; init Gtk; init Gtk::Gdk::ImlibImage; $file = "sungear.png"; $im = load_image Gtk::Gdk::ImlibImage($file); $w = $im->rgb_width; $h = $im->rgb_height; $win = new Gtk::Gdk::Window( { 'window_type' => 'toplevel', 'width' => $w, 'height' => $h, 'event_mask' => ['structure_mask'] }); $im->render($w, $h); $p = $im->move_image(); $m = $im->move_mask; $win->set_back_pixmap($p, 0); $win->shape_combine_mask($m, 0, 0,) if $m; $win->clear; $win->show; Gtk::Gdk->flush; Thanx. benr. |
From: eric r. <e...@er...> - 2001-09-26 00:12:28
|
On Tue, 25 Sep 2001 be...@cu... wrote: > Hello. > > I'm playing with GTK and Imlib in PERL (I'm new to windowing via PERL). > One little thing is nagging me. Why is it that when I call an image open it > closes immediately? Do I need to insert an infinite event loop that just > keeps rendering the image? How do I keep the thing on the screen? You need to make a call to Gtk->main once you're done with your setup code. That starts the GTK event loop. It doesn't keep re-render, it just waits for events. e; -- __ o o _ _ eric richardson __ ))c) __ __ _ __ __ _ __ ))_ ___ __ __)) __ __ _ _ __ __ _ _ (('((__,(('(| ((((_ (| ((((_((`(((_((| ((_( _))((_)((\( o ((_ ((_)((`1( http://ericrichardson.com http://ethreads.com http://escripting.com |