CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Tk: Auto-redraw?

 



Coderifous
journeyman

Oct 17, 2001, 10:26 PM

Post #1 of 7 (2077 views)
Tk: Auto-redraw? Can't Post

Currently developing a Tk user interface that, among other functions, calls (system) another program into operation. Since I'm developing for Windoh's I'm unable to fork. Problem: Mainloop is not returned to until outside program is closed causing my Tk app to get "whited out" if you drag a window over it. I don't care that the Tk app is frozen in the meantime, I just wish it wouldn't whiteout. Is there a solution to this phenomenon? Hopefully just a simple piece of code I'm currently ignorant to would do the trick.

Thanks in advance!



(This post was edited by Coderifous on Oct 17, 2001, 9:28 PM)


mhx
Enthusiast

Oct 21, 2001, 2:24 AM

Post #2 of 7 (2063 views)
Re: Tk: Auto-redraw? [In reply to] Can't Post

I'm not using Tk too much (unfortunately ;-), but perhaps this helps: You can use fork on the Windows platform. You can also use Pipes to communicate with a forked process. If the script only runs on Windows, you could also use the Win32::Process module from the libwin32 distribution.

-- Marcus


Code
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= 
($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"



Coderifous
journeyman

Oct 21, 2001, 8:49 AM

Post #3 of 7 (2060 views)
Re: Tk: Auto-redraw? [In reply to] Can't Post

You can use fork in windows? At work I tried using fork in one of my apps and it just wouldn't happen. So I copied the PerlCookbook example and it ran fine on Sun SOlaris Unix, but still crashed in windows. So I searched the net and saw a couple places where it was said that fork() didn't work for windows. So that's why I came to that conclusion. The Win32::Process module sounds like it will be my workaround.Smile I'm excited to use that on Monday at work. If you have a snippet of code that you've used on a WindowsNT system that utilizes fork(), post it would ya? I'd love to see how to get that beast working for my app.

Again Marcus: Thank you very much!

Jim



mhx
Enthusiast

Oct 21, 2001, 1:19 PM

Post #4 of 7 (2056 views)
Re: Tk: Auto-redraw? [In reply to] Can't Post

I've never used fork() before (just implicitly by open()ing pipes to other programs), but here's a small test script that ran just fine. I used ActivePerl 5.6.1 on a Windows 98 machine. I'm quite sure that if it runs on Win98, it'll run on WinNT.

Code
#!/bin/perl -w 
use strict;

my $pid = fork;

defined $pid or die "can't fork()\n";

if( $pid ) {
print "parent process (forked child: $pid)\n";
}
else {
print "child process\n";
}

Hope this helps.

-- Marcus


Code
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= 
($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"



Coderifous
journeyman

Oct 21, 2001, 5:44 PM

Post #5 of 7 (2055 views)
Re: Tk: Auto-redraw? [In reply to] Can't Post

Unfortunately... windows sucks again.

At home here I'm running Windows ME (forgive me please) and at work it's NT.

The unsupported function fork function is unimplemented at test.pl line 3.

That's the error it gives me. DAMMMMITTTTT!!!!!!
Oh well, I guess as newer versions of Windows are released, they are less compatible w/ anything not MS. Hell, eversince I installed Perl (activestate) it crashes all the time. The energy saver mode activates, and you have to reboot. It's like screen saver from hell or something. Anyways, thanks for the suggestion. I'd like to make it so that I can boot w/ unix or linux or something. I know a guy I can ask about that. Think I'll do just that. Thanks Marcus! Cool



mhx
Enthusiast

Oct 21, 2001, 9:09 PM

Post #6 of 7 (2052 views)
Re: Tk: Auto-redraw? [In reply to] Can't Post

Wow, I know Windows is sucky, but I can't believe that's the reason for your fork() error...
(At least I hope so since I'm going to run Win2K in the near future... but I'll be able to boot Linux as well, so I don't really care too much ;-)
However, perhaps the perlfork manpage has additional information that you may find useful. It's about Perl's fork()-emulation on systems that don't support fork() natively (like Windows).
As far as I could find out, the ActivePerl supports fork() emulation since 5.6.0, with significant improvements in 5.6.1 (see perldelta). So you should make sure that you're running 5.6.1. Right now I've successfully run my test script on WinNT 4, ActivePerl 5.6.0 / Build 618. So I strongly hope this will work on your NT machine, too.

-- Marcus


Code
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= 
($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"



Coderifous
journeyman

Oct 23, 2001, 9:51 AM

Post #7 of 7 (2047 views)
Re: Tk: Auto-redraw? [In reply to] Can't Post

I'm lovin life w/ Win32::Process !!!
Thanks again Marcus.Smile
PS - It's a miracle you do all this for no more than gratitude.


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives