http://www.perlmonks.org?node_id=1014269


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