Greetings all,
I have been working with Tk recently and I love how easy it makes GUI development. However I have run into a bit of a problem and Im hoping it is something fairly simple to remedy.
Here is a brief desciption:
I have an object I created that handles the parsing of a particular type of text file from a shared directory on our network. I have wrapped this object in a Tk interface and everything is working just fine. However since I want to allow users to batch process directories of files I have to show them the current progress of what is going on so they don't think the computer is frozen.
- So in Tk the user selects a directory to upload files from.
- The script reads how many files are in the directory that match the given extention and displays "XXX files found", then produces a button "Load Files".
- The "Load Files" button calls a subroutine "&loadfiles" and passes it an array reference of matching files from the selected directory.
The problem is within "&loadfiles" I am attempting to produce a log window
$logwin = $framename->Scrolled('Text', -height=>10, -width=>50, -scrol
+lbars=>'e')->pack(-side=>'top', -padx=>4, -expand=>1);
that I can then insert file processing status to. However, when I click on "Load Files" the script is waiting for "&loadfiles" to finish before it returns anything and thus the log window only shows up after everything has been processed.
I would like to be able to create the log window first and insert parsing status as it goes through the array, otherwise the users might think the computer is frozen and start clicking like mad.
What have I tried?
I have tried creating the screen in a seperate sub, then from within the button command checking if the screen was created successfully. If so start loading the files. Still no dice.
Does this sort of thing require forking a child process that I get status from?
Any suggestions? I can post code if needed.
Thanks in advance.
Update!
Well I got it working. A combination of
$Widget->update; and
$framename->see("end"); did it.
Im still open to suggestions though if anyone sees a problem with my current solution. Thanks again.
-InjunJoel
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo
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.