<?xml version="1.0" encoding="windows-1252"?>
<node id="1015242" title="TKX Time events using After" created="2013-01-24 17:58:45" updated="2013-01-24 17:58:45">
<type id="1042">
CUFP</type>
<author id="1015238">
Pherry</author>
<data>
<field name="doctext">
&lt;p&gt;
There does not appear to be a lot of examples of Tkx specific code snippets out there, especially the basics. Hopefully this helps someone.
&lt;/p&gt;

&lt;code&gt;
#! /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-&gt;new(".");

my $label = $mainwindow-&gt;new_ttk__label(-textvariable =&gt; \$tic)-&gt;g_pack;

my $progress_bar = $mainwindow-&gt;new_ttk__progressbar(
            -orient =&gt; "horizontal",
            -mode =&gt; "indeterminate",
            -length =&gt; "200",
            -maximum =&gt; "50",
            -variable =&gt; \$tic,
    )-&gt;g_pack;


&amp;tix; #first call to increment subroutine

Tkx::MainLoop();



sub tix { #increment sub
    $tic++;
Tkx::after(500, \&amp;tix); # after 500ms re-run this sub.
}
&lt;/code&gt;</field>
</data>
</node>
