examples/tcolour
raw| 1 | #!/usr/local/bin/perl -w |
| 2 | |
| 3 | use Tk; |
| 4 | |
| 5 | my $mw = MainWindow->new; |
| 6 | |
| 7 | my $t = $mw->Text(-background => 'yellow', -width => 30, -height => 10); |
| 8 | $t->pack(-expand => 1, -fill => 'both'); |
| 9 | |
| 10 | $t->insert('1.0','This is Text','Atag'); |
| 11 | $t->tagConfigure('Atag',-background => 'green'); |
| 12 | |
| 13 | $mw->Button(-text => "Change Colour", |
| 14 | -command => sub { $t->tagConfigure('Atag',-background => undef) } |
| 15 | )->pack; |
| 16 | |
| 17 | MainLoop; |