#! /usr/bin/perl -w # # tkx_counter.pl # 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_pack; 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. }