Just another Perl shrine | |
PerlMonks |
Re: Perl/Tk threading and/or cron job?by liverpole (Monsignor) |
on Sep 20, 2011 at 13:55 UTC ( [id://926946]=note: print w/replies, xml ) | Need Help?? |
Hi PhysiciSteve,
It may help us more if you show what you've tried. Having said that, I'll give you a very simple example that may do more-or-less what you need. It starts a worker thread which calculates the localtime every minute, and passes that to the main thread through the shared variable $ltime. It's important to keep the Tk code separate from the thread code (because Tk is not thread-safe), which is why the textvariable '$lbl_label' was kept separate from $ltime, and only assigned from $ltime from within the Tk idle loop update_gui(). You can, of course, change sleep 60; to a smaller interval to see it update more often:
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
In Section
Seekers of Perl Wisdom
|
|