|go ahead... be a heretic|
Re^5: Perl tk gui hangs when large data thrown to itby BrowserUk (Pope)
|on Oct 16, 2013 at 05:01 UTC||Need Help??|
The bottom line is that your gui is not "hanging"; it is just never getting around to updating because you are keeping it so busy that it never has time to update the screen.
You have a fundamental disconnect in your understanding of how Tk -- and guis in general -- work; between what you are expecting to happen and what actually happens.
This is perhaps best illustrated by this piece of your code:
First you change the text to "pending"; then immediately to "waiting". You are expecting the screen to update between the two changes such that a user might notice the change. That will never happen. Firstly, by default, the screen will not update until the program has nothing else to do. That means, at least until your changeItem() subroutine returns. So the first of the two changes in each branch of your while loop are completely redundant because they will never be shown on screen.
But it is much worse than that. Your subroutine changes 100 items (twice each) every time it is called. And you are (attempting to) calling it every millisecond. So -- if that were possible, which it isn't -- each of the two changes would be on-screen for a maximum of half a millisecond. The human eye/brain simply cannot detect changes at anything close to that rate.
Historically, movies were shown at 24 frames/second. Recently there have been moves to project movies at 48 frames/sec -- though most experts conclude that this is at least 50% higher than any human being can distinguish any difference. You are trying to achieve a rate of 2000 frames/sec.
Besides that it is totally impossible; what would be the point? Jet fighter pilots reaction times can -- under absolutely ideal conditions of total immersion and rigourously-trained, muscle-memory actions -- achieve physical (finger) reactions to visual stimuli in just under 1/10th of 1 second.
What are you hoping your user/operator will be able to do with seeing statuses change 2000 times a second?
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.