Kristofer,
The main issue is that you need to update the
widget to see the changes.
Use $widget->update inside your loop to do
this.
Also, although your use of configure (-text=>$i) for the label will
work, a cleaner method to accomplish this would be to use -textvariable
instead.
Here is your code with the changes:
-------------
use
Tk;
$mw = MainWindow->new();
$mw->title("conference
client");
$mw->geometry("800x600+0+0");
$mw->focus();
$i =
1;
# $l = $mw->Label(-text=>"$i")->pack;
# your line
$l =
$mw->Label(-textvariable=>\$i)->pack; # my
line
while($i<5)
{
$mw->update; # this updates the widget in between the
iterations
$i++;
#
$l->configure(-text=>"$i"); # not needed anymore using
textvariable
sleep(1);
}
MainLoop;
-------------
-----Original Message-----
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Kristofer Wolff
Sent: Tuesday, December 11, 2001 4:37
AM
To: [EMAIL PROTECTED]; perllist
Subject: AW: Tk and
loops
hi john,
hm, if i do a while in a tk programm, it runs
to the start point and looped
while i terminate the pl with
'strg'+'alt'+'del' :-))
try this:
---------
use Tk;
$mw =
MainWindow->new();
$mw->title("conference
client");
$mw->geometry("800x600+0+0");
$mw->focus();
$i =
1;
$l =
$mw->Label(-text=>"$i")->pack;
while($i<5)
{
$i++;
$l->configure(-text=>"$i");
sleep(1)
}
MainLoop;
----------
Please tell me how you can draw
all windows with the fully event of bind's
and commands (Buttons, etc..) and
fill a listbox while looping... I can't
get it !
Thanx
Kris
-----Urspr�ngliche Nachricht-----
Von: John V. Pataki [mailto:[EMAIL PROTECTED]]
Gesendet:
Dienstag, 11. Dezember 2001 02:42
An: Kristofer Wolff; perllist
Betreff:
RE: Tk and loops
Kristofer,
I implemented continous checking
and Tk just by using a while loop.
while (1) {
... perl
code here ...
} # end while
You can have conditionals embedded
in the loop to point to your subroutines
and then return to the while
loop.
I am not sure if there is a better way to do this, but it works for
me.
I was checking NT services, files, and processes.
Of course this
assumes that this is all that you want to do with
your
program.
HTH,
John
-----Original
Message-----
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Kristofer Wolff
Sent: Monday, December 10, 2001 7:27
AM
To: perllist
Subject: Tk and loops
Hi list,
how can i
loop a subroutine in a tk proggi ??
i have a sub that is checking a
directory and i want to do this every n
seconds. I tryed to fork it, but my
NT-box dosn't like it in my prog....
does anybody has a solution for
doing this
?
_______________________________________________
Perl-Win32-Web
mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
_______________________________________________
Perl-Win32-Web mailing
list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
