in reply to Re: Tk Scrolled textbox, parse on input?
in thread Tk Scrolled textbox, parse on input?
The error says that $_ is not initialized but $_1 is? Why is this so and how can I accomplish what I want to do in this sub if I cannot use $_?use Tk; use strict; use warnings; my $mw = new MainWindow(title => "demo"); my $entry = $mw->Scrolled("Text", -scrollbars => 'e', -font => '12')-> +pack(-side => 'bottom', -fill => 'both', -expand => 1); #$entry->bind("<KeyRelease>", [sub {print $_[1];}, Ev('A')]); $entry->bind("<KeyRelease>", [\&color, Ev('A')]); $entry->tagConfigure("blue", -foreground => "blue"); MainLoop; sub color { my $count = 0; my @char = split(//, $_); my @word = split(/ /, $_); foreach my $char (@char) { $count++; } foreach my $word (@word) { if ($word =~ /color/) { my $len = length($word); my $from = "1\.$count"; my $next = $from + $len; $entry->tagAdd("blue", $from, $next); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Tk Scrolled textbox, parse on input?
by Mr. Muskrat (Canon) on Dec 08, 2003 at 05:16 UTC | |
by pg (Canon) on Dec 08, 2003 at 06:19 UTC | |
by Elijah (Hermit) on Dec 08, 2003 at 14:21 UTC | |
|
Re: Re: Re: Tk Scrolled textbox, parse on input?
by pg (Canon) on Dec 08, 2003 at 05:16 UTC |