[PERL Tk] printing Line number in Text widget
- by ungalnanban
I use the following code for printing the line number in Text widget.
my $c=0; my $r=0;
$txt = $mw-Text( -background
='white',
-width=>400,
-height=>300,
-selectbackground => 'skyblue',
-insertwidth => 5,
-borderwidth =>3,
-highlightcolor => 'blue', ### after visit
-highlightbackground => 'red' , ### default before visit
-xscrollcommand => sub { print"CHAT NO :",$c++; },
# Determines the callback used when the Text widget is scrolled
horizontally.
-yscrollcommand = sub { print"LINR NO:",$r++; },
# Determines the callback used when the Text widget is scrolled
vertically.
-padx = 5,
-pady = 5,
)- pack ();
the above code is printing the line number and character no is ok.
but I used in Scrolled widget that output is not printing.
what is the problem in the following code how can I solve this?
$txt = $mw-Scrolled('Text', -scrollbars = 'se',
-background ='white',
-width=>400,
-height=>300,
-insertwidth => 5,
-borderwidth =>3,
-highlightcolor => 'blue', ### after visit
-highlightbackground => 'red' , ### default before visit
-padx => 5,
-pady => 5,
-xscrollcommand => sub { print"CHAT NO :",$c++; },
# Determines the callback used when the Text widget is scrolled horizontally.
-yscrollcommand => sub { print"LINR NO :",$r++; },
# Determines the callback used when the Text widget is scrolled vertically.
)->pack();