Re: pixbuf to pixmap issues



On Thu, 28 May 2009 11:15:08 +1000
Kevin Ryde <user42 zip com au> wrote:

"Zane C.B." <v velox vvelox net> writes:

'Gdk-CRITICAL **: gdk_screen_list_visuals: assertion
`GDK_IS_SCREEN (screen)''

Did you remember Gtk2->init, or the '-init' option equivalent?
The errors are pretty obscure if you forget that.

Awesome. Thanks, was not aware it was required for stuff running
outside of a loop.

Now for some odd reason I am getting the error 'Can't call method
"set_back_pixmap" on an undefined value'. $pixmap is definitely a
Gtk2::Gdk::Pixmap object according to ref and what I am passing as a
file is a legit jpg. Any thoughts?

        Gtk2->init;

        my $screen=Gtk2::Gdk::Screen->new;
        my $window=$screen->get_root_window;

        my $pixbuf=Gtk2::Gdk::Pixbuf->new_from_file('test.jpg');

        my ($pixmap, $mask)=$pixbuf->render_pixmap_and_mask(1);

        if (!defined($pixmap)) {
                print "pixmap undefined\n";
        }else {
                print ref($pixmap)."\n";
        }

        $window->set_back_pixmap($pixmap);

Attachment: signature.asc
Description: PGP signature



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