Stoney2005 has asked for the wisdom of the Perl Monks concerning the following question:
I also tried using pack instead of grid, telling $mw-> update(); in the subs, i tried telling $label_running_time_time to update in the subs. I'm kinda at a loss for how to fix it. http://www.ibm.com/developerworks/linux/library/l-ptkwidg/ i used this for reference. specifically the pathentry widget. any help would be appreciative. Also not sure if it will make a difference but i'm running perl v5.10.1 on x86_64-linux-gnu-thread-multi on debian 2.6.38-2-amd64#!/usr/bin/env perl use Tk; use Time::Stopwatch; $mw = new MainWindow; #Initialize main window $ongoing_time = 0; my $label_running_time_time = $mw -> Label(-textvariable=> \$ongoing_t +ime, -relief=>'groove') -> grid(-row=>9,-column=>2); # bind with tie: +:watch my $button_start_recording = $mw -> Button(-text => "Start", -command +=>\&start_recording_button) -> grid(-row=>10,-column=>1); # duuh my $button_stop_recording = $mw -> Button(-text => "Stop", -command => +\&stop_recording_button) -> grid(-row=>10,-column=>3); # duhh sub start_recording_button {tie $ongoing_time, 'Time::Stopwatch';} sub stop_recording_button {print "Time: $ongoing_time\n";} MainLoop;
In a bit if i can find a new one then i'll post ituse Tk; use Time::Duration; $start_time = time(); print "Start Time: $start_time\n"; $mw = MainWindow->new(); $timi = $mw->Label( -textvariable=>\$elapsed_time, -foreground=>'blue' + )->pack; $mw->Button( -text=>'Quit', -command=>sub{ exit } )->pack; $mw->Button( -text=>'Update', -command=>sub{ print "New Time: $elapsed +_time\n"; } )->pack; sub update_time {$elapsed_time = concise(duration_exact(time() - $star +t_time)); $timi->update();} $timi->repeat(50,\&update_time); MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TK textvariable not updating
by Anonymous Monk on May 28, 2011 at 20:33 UTC |