Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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


Comment on Re: In Tk how to set the color of the scrollbar?
Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2015-07-28 07:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (252 votes), past polls