Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

how to use marquee in perl tk?

by virudinesh (Acolyte)
on May 02, 2013 at 11:06 UTC ( #1031730=perlquestion: print w/ replies, xml ) Need Help??
virudinesh has asked for the wisdom of the Perl Monks concerning the following question:

1. am need marquee in my main window
2. need simple example for this one..

Comment on how to use marquee in perl tk?
Re: how to use marquee in perl tk?
by marto (Bishop) on May 02, 2013 at 11:13 UTC
Re: how to use marquee in perl tk?
by Anonymous Monk on May 02, 2013 at 12:43 UTC
    #!/usr/bin/perl -- use strict; use warnings; use Tk; Main( @ARGV ); exit( 0 ); sub Main { my $mw = tkinit; my $marq = marq( $mw , [ 'Anonymous Monk loves the color pink and +pancakes', ] ); $mw->Button( -text => 'stop', -command => sub { $marq->{_marq_timer}->cancel; } )->pack( qw/ -anchor nw / ); $marq->configure(qw/ -background pink /); $marq->pack(qw/-anchor nw /); marq( $mw , [ @INC ] )->pack(qw/-anchor sw -expand both /); $mw->MainLoop; } sub marq { my( $mw, $messages ) = @_; my $width = 20; $messages = ' ' x $width . join(' --- ', @$messages ); my $position = 0; my $showthis = ""; my $label = $mw->Label( -width => $width, -textvariable => \$showt +his); $label->{_marq_timer} = $mw->repeat( 50, sub { if( $position > length $messages ){ $position = 0; } my $format = '%-'.$width.'s'; my $newmsg = sprintf $format, substr $messages, $position, + $width; $position++; $showthis = $newmsg; return; }, ); return $label; }; __END__
Re: how to use marquee in perl tk?
by hdb (Prior) on May 02, 2013 at 13:08 UTC
    use strict; use warnings; use Tk; my $text = "this is a test..."; my $mw = new MainWindow; $mw->Label(-textvariable=>\$text)->pack(-fill=>'both'); $mw->repeat(200,[sub{$text=~s/(.)(.*)/$2$1/}]); MainLoop;

    Based on marto's advice above.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1031730]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2015-01-28 09:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (213 votes), past polls