Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

In Tk how to set the color of the scrollbar?

by perllee (Novice)
on Jan 20, 2013 at 04:53 UTC ( [id://1014252]=perlquestion: print w/replies, xml ) Need Help??

perllee has asked for the wisdom of the Perl Monks concerning the following question:

Hi:

In Tk how to set the color of the scroll bar? windows XP.

I tried some options, but failed.

$lb = $mw->Scrollbar(-background=>'green',-troughcolor=>'blue');

Thanks.

Replies are listed 'Best First'.
Re: In Tk how to set the color of the scrollbar?
by zentara (Archbishop) on Jan 20, 2013 at 09:43 UTC
    This works on Linux:
    #!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new(); my $text_box = $mw->Scrolled("Text", -scrollbars => 'osoe', -relief => 'sunken', -takefocus => 1) ->pack(-expand => 1, -fill => 'both'); for(1..1000){ $text_box->insert('end', "$_ test\n"); $text_box->see('end'); } $text_box -> Subwidget("yscrollbar")->configure( -background => "lightgreen", -troughcolor => "black", -command => \&scrollcallback, ); MainLoop; #if you specify a scrollcallback, you will override the #normal scroll behavior. sub scrollcallback{ #restore original function $text_box->yview(@_); #do your stuff here print "1\n"; }

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
      Naturally it doesn't actually change the colors on winxp, it changes the attributes, the colors remain the same
Re: In Tk how to set the color of the scrollbar?
by BrowserUk (Patriarch) on Jan 20, 2013 at 05:02 UTC

    Tk options start with a minus sign. Eg. -background => 'green' etc.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      I'm sorry, typesetting errors.But the problem is still not solved.

        You'll be more likely to get help if you post a small, but working program that demonstrates the problem.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1014252]
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-03-29 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found