Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

comment on

( [id://3333]=superdoc: print w/replies, xml ) 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:

$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.

In reply to Re^5: Perl tk gui hangs when large data thrown to it by BrowserUk
in thread Perl tk gui hangs when large data thrown to it by ghosh123

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-06-16 05:50 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.