Re: Composite Widget Problem

Slaven Rezic <[email protected]>
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Ala Qumsieh <[email protected]> writes:

> Perhaps I'm missing something obvious here, but I'm
> really stumped. Why doesn't the Canvas have a black
> background in this script.
> 
[...]
> 
> It's just a composite mega widget with a just a
> (supposedly black) canvas.
> 

Add

    $w->ConfigSpecs(-background => ["SELF"]);

to the Populate method. This line overrides the default setting for
background, which says to propagate the widget's background color to
all children widgets. In your case, the canvas got the background
color of the enclosing frame.

The code responsible for this behaviour can be found in Tk/Derived.pm.
The comment there says:

 # Now some hacks that cause colours to propogate down a composite widget
 # tree - really needs more thought, other options adding such as active
 # colours too and maybe fonts

-foreground is handled the same.

(Yes, I also stumbled many times over this behaviour)

Regards,
        Slaven

-- 
Slaven Rezic - slaven <at> rezic <dot> de

    Berlin Perl Mongers - http://berlin.pm.org
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.