You're looking at a fundamental problem with GUIs and synchronous I/O: While an I/O operation (a HTTP get in your case) is running, the GUI doesn't get refreshed, it looks "frozen".
There's a couple of different ways to fix this. You could use multiple processes or threads (one GUI-refresher, one HTTP-getter) or you could use an asynchronous approach like POE.
You've timed your question perfectly, because there's a new article out on how to do the latter: Using GUIs (Gtk in this case, but it works for Tk, too) and POE for I/O, all in one process, all smoothly:
The April
issue of the German Linux-Magazin features a GUI-driven stock ticker, fetching stock quotes via HTTP. The British "Linux-Magazine" (also available in the US at Barnes & Noble) will print the article in its May issue (update: now available here).
Whichever language you prefer, the listing (at the bottom of the online article) should illustrate the general concept.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.