I have not found a way to 'disable' a window. However, I have just started trying to figure out how to use the 'iconify' or 'withdraw' method to achieve the same effect.
......
# hide the window
$mw1->iconify;
# Do stuff in the second window
# on submit of second window,
$mw2->destroy;
$mw1->deiconifiy;
.......
iconify does not prevent the user from maximizing and playing in the first window. It simply minimizes the window.
The 'withdraw' method hides the window. There is no icon to maximize, thus the user is prevented from playing in the first window, until the requirements in the second window are satisfied.
......
# hide the window
$mw1->withdraw;
# Do stuff in the second window
# on submit of second window,
$mw2->destroy;
$mw1->deiconifiy;
.......
The one problem I have not figured out how to catch yet, is.....
When the first window is withdrawn, if the user closes the second window via the
window controls, rather than letting the application close it on a 'Cancel' or 'Continue' button, the first window stays withdrawn. The application is still running, but there are no displayed windows. There needs to be some way to watch the second window for an inappropriate close, so you can 'deiconify' the first window. If I figure out an effective way to manage 'withdraw', I'll post it.
hey goBoating id like to do the same with the cmd window
(has to work on nt dont care about the rest)
my tkchat app use a few "print" before lauching the tk window
so this launch the tk window in the back of the cmd window ...
a) is it posible to specify "appear on top"
or b) how could i minimize the cmd window ?
thanks ---------------------------------------
someone knowledge ends where
someone else knowledge starts
1) Don't even have a command window. This can be done by using wPerl instead of perl. If you have ActiveState Perl, you already have wPerl. To use wPerl, you can rename the application from *.pl to *.wpl or call your application like 'wperl myscript.pl'.
2) If using a shortcut, change the shortcut to run 'minimized'. Actually on my system (NT), when the Tk window is displayed, the command window is minimized automagically.
3) Make the Tk window appear on top. I can't remember how to do this, but I could look it up tomorrow.
There is a way to disable the perl window (see below), I think I found it in the perl cookbook by O'Reilly about a yr ago.
In the following script VPConsole.pl was a Tk application I wrote that just needs to be swapped out for your perl application:
#!/usr/bin/perl -w
# loader - starts Perl scripts without the DOS window
use strict;
use Win32; # i.e. a windows32 application
use Win32:rocess; # Create the process object.
Win32:rocess::Create($Win32:rocess::Create:rocessObj,
'C:/Perl/bin/perl.exe', #the location of perl
'perl VpConsole.pl', # The perl program to be run
0, # Don't inherit.
DETACHED_PROCESS, # Make it a detached process
"." # run from current dir.
) or die print_error();
sub print_error()
{
# print the standard windows error message.
return Win32::FormatMessage( Win32::GetLastError() );
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.