Re: [gtk-list] Re: Gtk-Perl and Pixmaps



Dermot wrote:

> > $window = new Gtk::Window -toplevel;
> > ($pixmap, $mask) = Gtk::Gdk::Pixmap->create_from_xpm($window, #line 7
> >                          $window->style->bg('normal'), 'pixmaps/test.xpm');
> > show $window;
> > 
> > main Gtk;
> Hi, I think that you must $windowe->realize() before you can use it in 
> this way.

Tried that; still no luck.  It seems as if there's a problem with the way
I'm using Gtk::Gdk::Pixmap->create_from_xpm(...) rather than with the
params I'm passing it.  I get the same error when I implement your
suggestion (see below).  The other thing that I find odd is that a 'grep
"variable is not of type Gtk::Gdk::Pixmap" *.xs *.c' in Gtk/xs produces no
matches.

> 
> There is, apparently, a better way. I have read that it is better to use the
> perl equivalent of the C code below (from Damon Chaplin)
> 
>    GdkColormap *colormap;
> 
>    colormap = gtk_widget_get_colormap (widget);
>    gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask,
>                                                     NULL, "new.xpm");

I've implemented that as follows and still get the same error (with a
different line number, of course):

#!/usr/bin/perl

use Gtk;
init Gtk;

$win = new Gtk::Window -toplevel;
$cmap = $win->get_colormap;
($pixmap, $mask) = Gtk::Gdk::Pixmap->colormap_create_from_xpm($win, $cmap,
                           $win->style->bg('normal'), 'pixmaps/test.xpm');

show $win;
main Gtk;

----
I know nothing is done with the pixmap; I can't even create it at this
point:/

If it makes any difference, here's a ls -l pixmaps from the dir containing
the scripts above (and the same dir from which they are executed):

-rw-r--r--   1 eaganj   eaganj       3432 Sep  6 01:56 answered.xpm
-rw-r--r--   1 eaganj   eaganj       2039 Oct  3 07:03 test.xpm

I'm a bit boggled at this point...
FWIW, I'm using a cvs snapshot of gnome-perl taken 30 Sep 1999, but that
shouldn't be the cause since the Gtk/samples/test.pl pixmap stuff does
work.

Thanks for the help,
James

=============================================================================
==|  Dr. Noonian Soong  |===|  Noonian@dal.net  |===|  Noonian on DALnet  |==
-----------------------------------------------------------------------------
==|  Ferengi Rule of Aquisition Number 34:  War is good for business.     |==
==|  Ferengi Rule of Aquisition Number 35:  Peace is good for business.   |==
=============================================================================



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