Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^5: Perl tk gui hangs when large data thrown to it

by BrowserUk (Pope)
on Oct 16, 2013 at 05:01 UTC ( #1058388=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Perl tk gui hangs when large data thrown to it
in thread Perl tk gui hangs when large data thrown to it

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:

$hl->itemConfigure( $randRow, 3, -text => "pending", -style => $style2 ); $hl->itemConfigure( $randRow, 3, -text => "waiting", -style => $style2 );

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.


Comment on Re^5: Perl tk gui hangs when large data thrown to it
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1058388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (18)
As of 2014-07-11 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (227 votes), past polls