Auto-scroll entry (text field) : Text « GUI « Perl






Auto-scroll entry (text field)

 

#!/usr/local/bin/perl -w
use Tk;
use strict;

my $str = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789";

my $mw = MainWindow->new;
my $lframe = $mw->Frame->pack(-fill => 'both', -side => 'left', -expand => 1);

my $entry = $mw->Entry(
    -textvariable => \$str,
    -width => 12, 
    -font => "{Comic Sans MS} 72",
    -relief => 'raised',
    -highlightthickness => 0,
)->pack(-expand => 1, -fill => 'x', -side => 'left');


my $repeat_id = $mw->repeat(300, \&shift_banner);

MainLoop;

sub shift_banner {
    my $newstr = substr($str, 1) . substr($str, 0, 1);
    $str = $newstr;
}

   
  








Related examples in the same category

1.Bind mouse double click action to a Text control
2.Call Text insert function to add text to a Text control
3.Insert text to a Text control (TextField)
4.Set width and height of a Text
5.Use the Scrolled to control the scroll of a Text Entry
6.Change text in a Text (TextField) in radio button and checkbox button action
7.Configure a Text Widget
8.Create a scrolled Text widget
9.Entry(text field): Set highlightthickness
10.Entry(text field): set font
11.Fill the Entry (text field): textvariable
12.Get text input in a single line Text Box
13.Insert bold text to a Text widget
14.Insert text string to a Text Widget
15.Mark text in a Scrolled Text Widget
16.Single-Line Text Entry