Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^3: Perl::Gtk and Color tutorial

by blueberryCoffee (Scribe)
on Dec 15, 2004 at 10:30 UTC ( #414979=note: print w/replies, xml ) Need Help??

in reply to Re^2: Perl::Gtk and Color tutorial
in thread Perl::Gtk and Color tutorial

take a look at the perl-gtk2 class docs. Label is a subclass of widget, which provides the get_colormap function. In your above code change:
my $colormap = $l->window->get_colormap();
my $colormap = $l->get_colormap();
I have not used this but it looks right from the docs.

Replies are listed 'Best First'.
Re^4: Perl::Gtk and Color tutorial
by Crackers2 (Parson) on Dec 15, 2004 at 15:00 UTC

    That does get me a little further, but now it still fails on the last line:

    my $l = new Gtk::Label( "Success" ); my $colormap = $l->get_colormap(); my $gdk_color = Gtk::Gdk::Color->parse_color( "green" ); $gdk_color = $colormap->color_alloc( $gdk_color ); $l->window->set_background( $gdk_color );

    $l->window is undefined, so can't do a set_background on it, and $l->set_background doesn't appear to exist either.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://414979]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2023-01-27 14:29 GMT
Find Nodes?
    Voting Booth?

    No recent polls found