Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

TKX Time events using After

by Pherry (Initiate)
on Jan 24, 2013 at 22:58 UTC ( #1015242=CUFP: print w/replies, xml ) Need Help??

There does not appear to be a lot of examples of Tkx specific code snippets out there, especially the basics. Hopefully this helps someone.

#! /usr/bin/perl -w # # # A basic demonstration of time-based refresh using the tkx wrapper # for TK. # Includes a single text label containing an incrementing # number along with a basic progress bar. use strict; use warnings; use Tkx; my $tic = 0; my $mainwindow = Tkx::widget->new("."); my $label = $mainwindow->new_ttk__label(-textvariable => \$tic)->g_pac +k; my $progress_bar = $mainwindow->new_ttk__progressbar( -orient => "horizontal", -mode => "indeterminate", -length => "200", -maximum => "50", -variable => \$tic, )->g_pack; &tix; #first call to increment subroutine Tkx::MainLoop(); sub tix { #increment sub $tic++; Tkx::after(500, \&tix); # after 500ms re-run this sub. }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://1015242]
Approved by ww
Front-paged by Arunbear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (13)
As of 2017-04-25 19:10 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (462 votes). Check out past polls.