Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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
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 studying the Monastery: (13)
As of 2014-07-29 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (220 votes), past polls