scrollbar subwidgets

11 views
Skip to first unread message

fidokomik

unread,
Apr 5, 2018, 8:36:16 AM4/5/18
to
Anybody know how to control subwidgets in Scrollbar? For example I want to color top arrow of yscrollbar red and bottom arrow green.

-------------
#!/usr/bin/perl

use strict;
use Tk;
use Tk::ROText;

our $mw = MainWindow->new();
our $r=$mw->Scrolled('ROText',
-highlightthickness=>0,
-relief=>'sunken',
-background=>'white',
-width=>30,
-height=>20,
-scrollbars=>'e')->pack;
foreach (1..50) {
$r->insert('end', "$_ Some text here.\n");
}
my $s=$r->Subwidget('yscrollbar');

# this work
$s->configure(-width => 50, -bg => 'red');

# but next command print nothing
print $s->children,"\n";

$mw->bind("<Escape>" => sub{$mw->destroy;});

MainLoop;
-------------

chrischavez

unread,
Jun 25, 2019, 3:24:43 AM6/25/19
to
On Thursday, April 5, 2018 at 7:36:16 AM UTC-5, fidokomik wrote:
> Anybody know how to control subwidgets in Scrollbar? For example I want to color top arrow of yscrollbar red and bottom arrow green.


This is old, but to try answering the question:

The standard Scrollbar is implemented as a single widget, and is not composed of smaller individual subwidgets. (I imagine this has the benefit of having consistent appearance for each windowing system—X11, MS Windows—and reflecting any user preferences.)

I'm not aware whether someone else has already created a customizable Scrollbar as you describe. Maybe a Scale widget and a couple of Button widgets for arrows is one alternative.
Reply all
Reply to author
Forward
0 new messages