Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: In Tk how to set the color of the scrollbar?

by zentara (Archbishop)
on Jan 20, 2013 at 09:43 UTC ( #1014269=note: print w/replies, xml ) Need Help??

in reply to In Tk how to set the color of the scrollbar?

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

Replies are listed 'Best First'.
Re^2: In Tk how to set the color of the scrollbar? (can't on WinXp)
by Anonymous Monk on Jan 20, 2013 at 10:06 UTC
    Naturally it doesn't actually change the colors on winxp, it changes the attributes, the colors remain the same

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014269]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2018-03-18 22:48 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (231 votes). Check out past polls.